use new require extensions in all places

This commit is contained in:
William Banfield
2022-05-13 17:09:47 -04:00
parent 504bffce4d
commit c0bf3307c9
+4 -10
View File
@@ -695,7 +695,7 @@ func (cs *State) sendInternalMessage(ctx context.Context, mi msgInfo) {
// Reconstruct LastCommit from SeenCommit, which we saved along with the block,
// (which happens even before saving the state)
func (cs *State) reconstructLastCommit(state sm.State) {
requireExtensions := requireVoteExtensions(cs.state.ConsensusParams.Vote.ExtensionRequireHeight, state.LastBlockHeight)
requireExtensions := cs.state.ConsensusParams.Vote.RequireExtensions(state.LastBlockHeight)
votes, err := cs.votesFromExtendedCommit(state, requireExtensions)
if err == nil {
cs.LastCommit = votes
@@ -838,7 +838,8 @@ func (cs *State) updateToState(state sm.State) {
cs.ValidRound = -1
cs.ValidBlock = nil
cs.ValidBlockParts = nil
cs.Votes = cstypes.NewHeightVoteSet(state.ChainID, height, validators, requireVoteExtensions(state.ConsensusParams.Vote.ExtensionRequireHeight, height))
requireExtensions := state.ConsensusParams.Vote.RequireExtensions(height)
cs.Votes = cstypes.NewHeightVoteSet(state.ChainID, height, validators, requireExtensions)
cs.CommitRound = -1
cs.LastValidators = state.LastValidators
cs.TriggeredTimeoutPrecommit = false
@@ -2389,7 +2390,7 @@ func (cs *State) addVote(
if !errors.Is(err, types.ErrVoteExtensionAbsent) {
return false, err
}
if requireVoteExtensions(cs.state.ConsensusParams.Vote.ExtensionRequireHeight, cs.Height) {
if cs.state.ConsensusParams.Vote.RequireExtensions(cs.Height) {
return false, err
}
}
@@ -2789,13 +2790,6 @@ func (cs *State) calculateProposalTimestampDifferenceMetric() {
}
}
func requireVoteExtensions(requireHeight, currentHeight int64) bool {
if requireHeight == 0 || currentHeight < requireHeight {
return false
}
return true
}
// proposerWaitTime determines how long the proposer should wait to propose its next block.
// If the result is zero, a block can be proposed immediately.
//