From 64fd469741d5889c3631fbb109532a2bbc4cd6b2 Mon Sep 17 00:00:00 2001 From: Edgar Aroutiounian Date: Thu, 2 Apr 2020 11:26:54 -0700 Subject: [PATCH] [blockchain] More info in failed validator voting power update (#2685) --- core/blockchain.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index 5a2966087..0b5d1c2ea 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -64,6 +64,7 @@ var ( ErrNoGenesis = errors.New("Genesis not found in chain") // errExceedMaxPendingSlashes .. errExceedMaxPendingSlashes = errors.New("exceeed max pending slashes") + errNilEpoch = errors.New("nil epoch for voting power computation") ) const ( @@ -2282,7 +2283,6 @@ func (bc *BlockChain) UpdateValidatorVotingPower( batch rawdb.DatabaseWriter, block *types.Block, newEpochSuperCommittee, currentEpochSuperCommittee *shard.State, - // NOTE Do not update this state, only read from state *state.DB, ) error { if newEpochSuperCommittee == nil { @@ -2294,7 +2294,12 @@ func (bc *BlockChain) UpdateValidatorVotingPower( for i := range newEpochSuperCommittee.Shards { subCommittee := &newEpochSuperCommittee.Shards[i] if newEpochSuperCommittee.Epoch == nil { - return errors.New("nil epoch for voting power computation") + return errors.Wrapf( + errNilEpoch, + "block epoch %v current-committee-epoch %v", + block.Epoch(), + currentEpochSuperCommittee.Epoch, + ) } roster, err := votepower.Compute(subCommittee, newEpochSuperCommittee.Epoch) if err != nil {