diff --git a/consensus/state.go b/consensus/state.go index b5fb1c0d1..acb001063 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -1492,7 +1492,7 @@ func (cs *State) recordMetrics(height int64, block *types.Block) { "validator_address", privValAddress.String(), } cs.metrics.ValidatorPower.With(label...).Set(float64(val.VotingPower)) - if !commitSig.Absent() { + if commitSig.ForBlock() { cs.metrics.ValidatorLastSignedHeight.With(label...).Set(float64(height)) } else { cs.metrics.ValidatorMissedBlocks.With(label...).Add(float64(1)) diff --git a/types/block.go b/types/block.go index 45cb8d827..206ea4414 100644 --- a/types/block.go +++ b/types/block.go @@ -466,6 +466,11 @@ func NewCommitSigForBlock(signature []byte, valAddr Address, ts time.Time) Commi } } +// ForBlock returns true if CommitSig is for the block. +func (cs CommitSig) ForBlock() bool { + return cs.BlockIDFlag == BlockIDFlagCommit +} + // NewCommitSigAbsent returns new CommitSig with BlockIDFlagAbsent. Other // fields are all empty. func NewCommitSigAbsent() CommitSig {