Skip to content

Commit

Permalink
check previous state when starting the process
Browse files Browse the repository at this point in the history
  • Loading branch information
tok-kkk committed Jan 29, 2020
1 parent 174a073 commit 7ccc1c6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,20 @@ func (p *Process) Start() {
}
}

if p.state.CurrentStep <= StepPropose {
// Start the Process from previous state.
switch p.state.CurrentStep{
case StepNil, StepPropose:
p.startRound(p.state.CurrentRound)
case StepPrevote:
if numPrevotes >= 2 * p.state.Prevotes.f + 1{
p.scheduleTimeoutPrevote(p.state.CurrentHeight, p.state.CurrentRound, p.timer.Timeout(StepPrevote, p.state.CurrentRound))
}
case StepPrecommit:
if numPrecommits >= 2 * p.state.Precommits.f + 1{
p.scheduleTimeoutPrecommit(p.state.CurrentHeight, p.state.CurrentRound, p.timer.Timeout(StepPrecommit, p.state.CurrentRound))
}
default:
panic("unknown step value")
}
}

Expand Down

0 comments on commit 7ccc1c6

Please sign in to comment.