comment out staking debug code which can be uncommented later for debugging; we are not done yet

pull/1795/head
chao 5 years ago
parent 8a71ea671b
commit 5dd83cd4be
  1. 1
      core/blockchain.go
  2. 30
      node/node_handler.go

@ -2344,6 +2344,7 @@ func (bc *BlockChain) UpdateValidatorList(tx *staking.StakingTransaction) error
switch tx.StakingType() {
case staking.DirectiveCreateValidator:
createValidator := decodePayload.(*staking.CreateValidator)
// TODO: batch add validator list instead of one by one
list, err := bc.ReadValidatorList()
if err != nil {
return err

@ -411,21 +411,23 @@ func (node *Node) PostConsensusProcessing(newBlock *types.Block, commitSigAndBit
func (node *Node) AddNewBlock(newBlock *types.Block) error {
_, err := node.Blockchain().InsertChain([]*types.Block{newBlock}, true /* verifyHeaders */)
// Debug only
addrs, err := node.Blockchain().ReadValidatorList()
utils.Logger().Debug().Msgf("validator list updated, err=%v, len(addrs)=%v", err, len(addrs))
for i, addr := range addrs {
val, err := node.Blockchain().ValidatorInformation(addr)
if err != nil {
utils.Logger().Debug().Msgf("ValidatorInformation Error %v: err %v", i, err)
/*
// Debug only
addrs, err := node.Blockchain().ReadValidatorList()
utils.Logger().Debug().Msgf("validator list updated, err=%v, len(addrs)=%v", err, len(addrs))
for i, addr := range addrs {
val, err := node.Blockchain().ValidatorInformation(addr)
if err != nil {
utils.Logger().Debug().Msgf("ValidatorInformation Error %v: err %v", i, err)
}
utils.Logger().Debug().Msgf("ValidatorInformation %v: %v", i, val)
}
utils.Logger().Debug().Msgf("ValidatorInformation %v: %v", i, val)
}
currAddrs := node.Blockchain().CurrentValidatorAddresses()
utils.Logger().Debug().Msgf("CurrentValidators : %v", currAddrs)
candidates := node.Blockchain().ValidatorCandidates()
utils.Logger().Debug().Msgf("CandidateValidators : %v", candidates)
// Finish debug
currAddrs := node.Blockchain().CurrentValidatorAddresses()
utils.Logger().Debug().Msgf("CurrentValidators : %v", currAddrs)
candidates := node.Blockchain().ValidatorCandidates()
utils.Logger().Debug().Msgf("CandidateValidators : %v", candidates)
// Finish debug
*/
if err != nil {
utils.Logger().Error().

Loading…
Cancel
Save