types: make timely predicate adaptive per round

This commit is contained in:
William Banfield
2022-01-31 13:41:07 -05:00
parent e87d40719d
commit 5ccd8ed804
3 changed files with 50 additions and 34 deletions
+2 -2
View File
@@ -1400,7 +1400,7 @@ func (cs *State) proposalIsTimely() bool {
MessageDelay: cs.state.ConsensusParams.Synchrony.MessageDelay,
}
return cs.Proposal.IsTimely(cs.ProposalReceiveTime, sp)
return cs.Proposal.IsTimely(cs.ProposalReceiveTime, sp, cs.Round)
}
func (cs *State) defaultDoPrevote(ctx context.Context, height int64, round int32) {
@@ -2570,7 +2570,7 @@ func (cs *State) calculateProposalTimestampDifferenceMetric() {
MessageDelay: cs.state.ConsensusParams.Synchrony.MessageDelay,
}
isTimely := cs.Proposal.IsTimely(cs.ProposalReceiveTime, tp)
isTimely := cs.Proposal.IsTimely(cs.ProposalReceiveTime, tp, cs.Round)
cs.metrics.ProposalTimestampDifference.With("is_timely", fmt.Sprintf("%t", isTimely)).
Observe(cs.ProposalReceiveTime.Sub(cs.Proposal.Timestamp).Seconds())
}