Skip to content

Commit e9db464

Browse files
committed
add 100ms header verification grace period to Clique
1 parent b2fb98e commit e9db464

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

consensus/clique/clique.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,10 @@ func (c *Clique) verifyHeader(chain consensus.ChainHeaderReader, header *types.H
254254
}
255255
number := header.Number.Uint64()
256256

257-
// Don't waste time checking blocks from the future
258-
if header.Time > uint64(time.Now().Unix()) {
257+
// Don't waste time checking blocks from the future.
258+
// We add 100ms leeway since the scroll_worker internal timers might trigger early.
259+
now := time.Now()
260+
if header.Time > uint64(now.Unix()) && time.Unix(int64(header.Time), 0).Sub(now) > 100*time.Millisecond {
259261
return consensus.ErrFutureBlock
260262
}
261263
// Checkpoint blocks need to enforce zero beneficiary

0 commit comments

Comments
 (0)