mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-29 14:11:21 +00:00
Revert to one action for commit-or-next-round
This commit is contained in:
parent
0f484b6315
commit
6416185a6f
@ -319,7 +319,7 @@ func (conR *ConsensusReactor) stepTransitionRoutine() {
|
||||
case RoundStepPrecommit:
|
||||
// Wake up when the round is over.
|
||||
time.Sleep(time.Duration((1.0 - elapsedRatio) * float64(roundDuration)))
|
||||
conR.doActionCh <- RoundAction{rs.Height, rs.Round, RoundActionNextRound}
|
||||
conR.doActionCh <- RoundAction{rs.Height, rs.Round, RoundActionTryCommit}
|
||||
case RoundStepCommit:
|
||||
panic("Should not happen: RoundStepCommit waits until +2/3 commits.")
|
||||
case RoundStepCommitWait:
|
||||
@ -372,8 +372,8 @@ ACTION_LOOP:
|
||||
if height != rs.Height {
|
||||
continue
|
||||
}
|
||||
// If action >= RoundActionCommit, the round doesn't matter.
|
||||
if action < RoundActionCommit && round != rs.Round {
|
||||
// If action >= RoundActionCommitWait, the round doesn't matter.
|
||||
if action < RoundActionCommitWait && round != rs.Round {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -412,18 +412,11 @@ ACTION_LOOP:
|
||||
scheduleNextAction()
|
||||
continue ACTION_LOOP
|
||||
|
||||
case RoundActionNextRound:
|
||||
if rs.Step >= RoundStepCommit {
|
||||
continue ACTION_LOOP
|
||||
}
|
||||
conR.conS.SetupRound(rs.Round + 1)
|
||||
scheduleNextAction()
|
||||
continue ACTION_LOOP
|
||||
|
||||
case RoundActionCommit:
|
||||
case RoundActionTryCommit:
|
||||
if rs.Step >= RoundStepCommit {
|
||||
continue ACTION_LOOP
|
||||
}
|
||||
if rs.Precommits.HasTwoThirdsMajority() {
|
||||
// NOTE: Duplicated in RoundActionCommitWait.
|
||||
vote := conR.conS.RunActionCommit(rs.Height, rs.Round)
|
||||
broadcastNewRoundStep(RoundStepCommit)
|
||||
@ -432,6 +425,12 @@ ACTION_LOOP:
|
||||
}
|
||||
// do not schedule next action.
|
||||
continue ACTION_LOOP
|
||||
} else {
|
||||
// Could not commit, move onto next round.
|
||||
conR.conS.SetupRound(rs.Round + 1)
|
||||
scheduleNextAction()
|
||||
continue ACTION_LOOP
|
||||
}
|
||||
|
||||
case RoundActionCommitWait:
|
||||
if rs.Step >= RoundStepCommitWait {
|
||||
|
@ -36,8 +36,7 @@ const (
|
||||
RoundActionPropose = RoundActionType(0x00) // Goto RoundStepPropose
|
||||
RoundActionPrevote = RoundActionType(0x01) // Goto RoundStepPrevote
|
||||
RoundActionPrecommit = RoundActionType(0x02) // Goto RoundStepPrecommit
|
||||
RoundActionNextRound = RoundActionType(0x04) // Goto next round RoundStepStart
|
||||
RoundActionCommit = RoundActionType(0x10) // Goto RoundStepCommit or RoundStepStart next round
|
||||
RoundActionTryCommit = RoundActionType(0x10) // Goto RoundStepCommit or RoundStepStart next round
|
||||
RoundActionCommitWait = RoundActionType(0x11) // Goto RoundStepCommitWait
|
||||
RoundActionFinalize = RoundActionType(0x12) // Goto RoundStepStart next height
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user