Remove local code

pull/1876/head
Rongjian Lan 5 years ago
parent c6e0fc68fa
commit 34dcb28bac
  1. 2
      cmd/harmony/main.go
  2. 10
      core/blockchain.go
  3. 2
      node/node_handler.go

@ -101,7 +101,7 @@ var (
// beaconSyncFreq indicates beaconchain sync frequency
beaconSyncFreq = flag.Int("beacon_sync_freq", 60, "unit in seconds")
// blockPeriod indicates the how long the leader waits to propose a new block.
blockPeriod = flag.Int("block_period", 2, "how long in second the leader waits to propose a new block.")
blockPeriod = flag.Int("block_period", 8, "how long in second the leader waits to propose a new block.")
leaderOverride = flag.Bool("leader_override", false, "true means override the default leader role and acts as validator")
// shardID indicates the shard ID of this node
shardID = flag.Int("shard_id", -1, "the shard ID of this node")

@ -2408,11 +2408,7 @@ func (bc *BlockChain) UpdateValidatorVotingPower(state shard.State) error {
for _, committee := range state {
for _, slot := range committee.Slots {
utils.Logger().Print("TTTTTTT")
utils.Logger().Print(committee.ShardID)
if slot.TotalStake != nil {
utils.Logger().Print("AAAAAA")
utils.Logger().Print(slot.TotalStake)
if _, ok := addrToEffectiveStakes[slot.EcdsaAddress]; !ok {
addrToEffectiveStakes[slot.EcdsaAddress] = map[uint32]numeric.Dec{}
}
@ -2425,9 +2421,6 @@ func (bc *BlockChain) UpdateValidatorVotingPower(state shard.State) error {
totalEffectiveStake[committee.ShardID] = numeric.NewDec(0)
}
totalEffectiveStake[committee.ShardID] = totalEffectiveStake[committee.ShardID].Add(*slot.TotalStake)
utils.Logger().Print("BBBBBB")
utils.Logger().Print(totalEffectiveStake[committee.ShardID])
utils.Logger().Print(addrToEffectiveStakes[slot.EcdsaAddress][committee.ShardID])
}
}
}
@ -2440,9 +2433,6 @@ func (bc *BlockChain) UpdateValidatorVotingPower(state shard.State) error {
addrTotalVotingPower = addrTotalVotingPower.Add(eStake.Quo(totalEffectiveStake[shardID]))
addrTotalEffectiveStake = addrTotalEffectiveStake.Add(eStake)
}
utils.Logger().Print("CCCCCCC")
utils.Logger().Print(addrTotalVotingPower)
utils.Logger().Print(addrTotalEffectiveStake)
// Retrieve the stats and update
stats, err := rawdb.ReadValidatorStats(bc.db, addr)
if stats == nil {

@ -386,8 +386,6 @@ func (node *Node) PostConsensusProcessing(newBlock *types.Block, commitSigAndBit
// Update voting power of validators for all shards
if len(newBlock.Header().ShardState()) > 0 {
shardState := shard.State{}
utils.Logger().Print("XXXXXXXX")
utils.Logger().Print(shardState.JSON())
if err := rlp.DecodeBytes(newBlock.Header().ShardState(), &shardState); err == nil {
if err = node.Blockchain().UpdateValidatorVotingPower(shardState); err != nil {
utils.Logger().Err(err)

Loading…
Cancel
Save