Skip to content

Commit 1d28a1c

Browse files
authored
Merge pull request #149 from getamis/feature/timeout
consensus/istanbul: set timeout correctly
2 parents 57b107b + 7f468e4 commit 1d28a1c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

consensus/istanbul/core/core.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,12 @@ func (c *core) newRoundChangeTimer() {
318318
c.stopTimer()
319319

320320
// set timeout based on the round number
321-
t := c.config.RequestTimeout + uint64(math.Pow(2, float64(c.current.Round().Uint64())))
322-
timeout := time.Duration(t) * time.Millisecond
321+
timeout := time.Duration(c.config.RequestTimeout) * time.Millisecond
322+
round := c.current.Round().Uint64()
323+
if round > 0 {
324+
timeout += time.Duration(math.Pow(2, float64(round))) * time.Second
325+
}
326+
323327
c.roundChangeTimer = time.AfterFunc(timeout, func() {
324328
c.sendEvent(timeoutEvent{})
325329
})

0 commit comments

Comments
 (0)