Skip to content

Commit

Permalink
fix some bugs when validators change (ethereum#58)
Browse files Browse the repository at this point in the history
* fix some bugs when validators change

* fix epochHeight

Co-authored-by: Qi Zhou <[email protected]>
  • Loading branch information
qizhou and Qi Zhou authored Mar 18, 2022
1 parent 27675ad commit 74f9497
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion consensus/tendermint/adapter/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func updateState(
if len(nextValidators) != len(nextVotingPowers) {
panic("len(nextValidators) != len(nextVotingPowers)")
}
nValSet = types.NewValidatorSet(nextValidators, nextVotingPowers, nValSet.ProposerReptition)
nValSet = types.NewValidatorSet(nextValidators, nextVotingPowers, state.Validators.ProposerReptition)
} else {
nValSet = state.Validators.Copy()
// Update validator proposer priority and set state variables.
Expand Down
2 changes: 1 addition & 1 deletion consensus/tendermint/tendermint.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ func (c *Tendermint) getEpochHeader(chain consensus.ChainHeaderReader, header *t
checkpoint := (number % c.config.Epoch) == 0
var epochHeight uint64
if checkpoint {
epochHeight -= c.config.Epoch
epochHeight = number - c.config.Epoch
} else {
epochHeight = number - (number % c.config.Epoch)
}
Expand Down

0 comments on commit 74f9497

Please sign in to comment.