consensus: use time.Until instead of time.Sub for easier to read

This commit is contained in:
9547 2024-06-05 19:29:00 +08:00
parent e85e21c932
commit 426a4e2aba

View file

@ -647,7 +647,7 @@ func (c *Clique) Seal(chain consensus.ChainHeaderReader, block *types.Block, res
}
}
// Sweet, the protocol permits us to sign the block, wait for our time
delay := time.Unix(int64(header.Time), 0).Sub(time.Now()) // nolint: gosimple
delay := time.Until(time.Unix(int64(header.Time), 0))
if header.Difficulty.Cmp(diffNoTurn) == 0 {
// It's not our turn explicitly to sign, delay it a bit
wiggle := time.Duration(len(snap.Signers)/2+1) * wiggleTime