|
|
@ -64,6 +64,7 @@ var ( |
|
|
|
ErrNoGenesis = errors.New("Genesis not found in chain") |
|
|
|
ErrNoGenesis = errors.New("Genesis not found in chain") |
|
|
|
// errExceedMaxPendingSlashes ..
|
|
|
|
// errExceedMaxPendingSlashes ..
|
|
|
|
errExceedMaxPendingSlashes = errors.New("exceeed max pending slashes") |
|
|
|
errExceedMaxPendingSlashes = errors.New("exceeed max pending slashes") |
|
|
|
|
|
|
|
errNilEpoch = errors.New("nil epoch for voting power computation") |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
const ( |
|
|
@ -2282,7 +2283,6 @@ func (bc *BlockChain) UpdateValidatorVotingPower( |
|
|
|
batch rawdb.DatabaseWriter, |
|
|
|
batch rawdb.DatabaseWriter, |
|
|
|
block *types.Block, |
|
|
|
block *types.Block, |
|
|
|
newEpochSuperCommittee, currentEpochSuperCommittee *shard.State, |
|
|
|
newEpochSuperCommittee, currentEpochSuperCommittee *shard.State, |
|
|
|
// NOTE Do not update this state, only read from
|
|
|
|
|
|
|
|
state *state.DB, |
|
|
|
state *state.DB, |
|
|
|
) error { |
|
|
|
) error { |
|
|
|
if newEpochSuperCommittee == nil { |
|
|
|
if newEpochSuperCommittee == nil { |
|
|
@ -2294,7 +2294,12 @@ func (bc *BlockChain) UpdateValidatorVotingPower( |
|
|
|
for i := range newEpochSuperCommittee.Shards { |
|
|
|
for i := range newEpochSuperCommittee.Shards { |
|
|
|
subCommittee := &newEpochSuperCommittee.Shards[i] |
|
|
|
subCommittee := &newEpochSuperCommittee.Shards[i] |
|
|
|
if newEpochSuperCommittee.Epoch == nil { |
|
|
|
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) |
|
|
|
roster, err := votepower.Compute(subCommittee, newEpochSuperCommittee.Epoch) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|