consensus: let time.Timer handle non-positive durations

This commit is contained in:
Ethan Buchman
2017-01-10 20:37:32 -05:00
parent 12d92fd5db
commit 55b4bfa1fe
4 changed files with 35 additions and 22 deletions

View File

@ -488,9 +488,6 @@ func (cs *ConsensusState) updateRoundStep(round int, step RoundStepType) {
func (cs *ConsensusState) scheduleRound0(rs *RoundState) {
//log.Info("scheduleRound0", "now", time.Now(), "startTime", cs.StartTime)
sleepDuration := rs.StartTime.Sub(time.Now())
if sleepDuration < time.Duration(0) {
sleepDuration = time.Duration(0)
}
cs.scheduleTimeout(sleepDuration, rs.Height, 0, RoundStepNewHeight)
}