From c6d0882eb7d374410d7fd564fddff09e9ef70308 Mon Sep 17 00:00:00 2001 From: tnasu Date: Mon, 28 Feb 2022 13:00:42 +0900 Subject: [PATCH] Fix compile error: `consensus: check proposal non-nil in prevote message delay metric (backport #7625) (#7631)` --- consensus/state.go | 6 +++--- types/validator_set.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/consensus/state.go b/consensus/state.go index 96c1622a6..ea0212f91 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -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 } diff --git a/types/validator_set.go b/types/validator_set.go index 9074cdf89..ed16f98dc 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -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()