Skip to content

Commit

Permalink
Fix compile error: `consensus: check proposal non-nil in prevote mess…
Browse files Browse the repository at this point in the history
…age delay metric (backport #7625) (#7631)`
  • Loading branch information
tnasu committed Feb 28, 2022
1 parent 37a574c commit c6d0882
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -2404,9 +2404,9 @@ func (cs *State) calculatePrevoteMessageDelayMetrics() {
})
var votingPowerSeen int64
for _, v := range pl {
_, val := cs.Validators.GetByAddress(v.ValidatorAddress)
votingPowerSeen += val.VotingPower
if votingPowerSeen >= cs.Validators.TotalVotingPower()*2/3+1 {
_, voter := cs.Voters.GetByAddress(v.ValidatorAddress)
votingPowerSeen += voter.VotingPower
if votingPowerSeen >= cs.Voters.TotalVotingPower()*2/3+1 {
cs.metrics.QuorumPrevoteMessageDelay.Set(v.Timestamp.Sub(cs.Proposal.Timestamp).Seconds())
break
}
Expand Down
4 changes: 2 additions & 2 deletions types/validator_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ func (vals *ValidatorSet) updateTotalStakingPower() {
vals.totalStakingPower = sum
}

// TotalStakingPower returns the sum of the voting powers of all validators.
// It recomputes the total voting power if required.
// TotalStakingPower returns the sum of the staking powers of all validators.
// It recomputes the total staking power if required.
func (vals *ValidatorSet) TotalStakingPower() int64 {
if vals.totalStakingPower == 0 {
vals.updateTotalStakingPower()
Expand Down

0 comments on commit c6d0882

Please sign in to comment.