Skip to content

Commit 9b29adb

Browse files
remove legacy triggered precommit logic
1 parent b95c261 commit 9b29adb

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

internal/consensus/state.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,6 @@ func (cs *State) updateToState(state sm.State) {
726726
cs.Votes = cstypes.NewHeightVoteSet(state.ChainID, height, validators)
727727
cs.CommitRound = -1
728728
cs.LastValidators = state.LastValidators
729-
cs.TriggeredTimeoutPrecommit = false
730729

731730
cs.state = state
732731

@@ -1052,7 +1051,6 @@ func (cs *State) enterNewRound(height int64, round int32) {
10521051
}
10531052

10541053
cs.Votes.SetRound(tmmath.SafeAddInt32(round, 1)) // also track next round (round+1) to allow round-skipping
1055-
cs.TriggeredTimeoutPrecommit = false
10561054

10571055
if err := cs.eventBus.PublishEventNewRound(cs.NewRoundEvent()); err != nil {
10581056
cs.Logger.Error("failed publishing new round", "err", err)
@@ -1491,12 +1489,10 @@ func (cs *State) enterPrecommit(height int64, round int32) {
14911489
// Enter: any +2/3 precommits for next round.
14921490
func (cs *State) enterPrecommitWait(height int64, round int32) {
14931491
logger := cs.Logger.With("height", height, "round", round)
1494-
1495-
if cs.Height != height || round < cs.Round || (cs.Round == round && cs.TriggeredTimeoutPrecommit) {
1492+
if cs.Height != height || round < cs.Round || (cs.Round == round && cstypes.RoundStepPrecommitWait <= cs.Step) {
14961493
logger.Debug(
14971494
"entering precommit wait step with invalid args",
1498-
"triggered_timeout", cs.TriggeredTimeoutPrecommit,
1499-
"current", fmt.Sprintf("%v/%v", cs.Height, cs.Round),
1495+
"current", fmt.Sprintf("%v/%v/%v", cs.Height, cs.Round, cs.Step),
15001496
)
15011497
return
15021498
}
@@ -1512,7 +1508,7 @@ func (cs *State) enterPrecommitWait(height int64, round int32) {
15121508

15131509
defer func() {
15141510
// Done enterPrecommitWait:
1515-
cs.TriggeredTimeoutPrecommit = true
1511+
cs.updateRoundStep(round, cstypes.RoundStepPrecommitWait)
15161512
cs.newStep()
15171513
}()
15181514

internal/consensus/types/round_state.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ type RoundState struct {
8585
ValidBlock *types.Block `json:"valid_block"` // Last known block of POL mentioned above.
8686

8787
// Last known block parts of POL mentioned above.
88-
ValidBlockParts *types.PartSet `json:"valid_block_parts"`
89-
Votes *HeightVoteSet `json:"votes"`
90-
CommitRound int32 `json:"commit_round"` //
91-
LastCommit *types.VoteSet `json:"last_commit"` // Last precommits at Height-1
92-
LastValidators *types.ValidatorSet `json:"last_validators"`
93-
TriggeredTimeoutPrecommit bool `json:"triggered_timeout_precommit"`
88+
ValidBlockParts *types.PartSet `json:"valid_block_parts"`
89+
Votes *HeightVoteSet `json:"votes"`
90+
CommitRound int32 `json:"commit_round"` //
91+
LastCommit *types.VoteSet `json:"last_commit"` // Last precommits at Height-1
92+
LastValidators *types.ValidatorSet `json:"last_validators"`
9493
}
9594

9695
// Compressed version of the RoundState for use in RPC

0 commit comments

Comments
 (0)