[blockchain] More info in failed validator voting power update (#2685)

pull/2687/head
Edgar Aroutiounian 5 years ago committed by GitHub
parent b9843abde5
commit 64fd469741
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      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 {

Loading…
Cancel
Save