diff --git a/cmd/faucet/faucet.go b/cmd/faucet/faucet.go index d42713abbd..050fc7f80b 100644 --- a/cmd/faucet/faucet.go +++ b/cmd/faucet/faucet.go @@ -517,7 +517,7 @@ func (f *faucet) apiHandler(w http.ResponseWriter, r *http.Request) { // Send an error if too frequent funding, othewise a success if !fund { - if err = sendError(wsconn, fmt.Errorf("%s left until next allowance", common.PrettyDuration(timeout.Sub(time.Now())))); err != nil { // nolint: gosimple + if err = sendError(wsconn, fmt.Errorf("%s left until next allowance", common.PrettyDuration(time.Until(timeout)))); err != nil { log.Warn("Failed to send funding error to client", "err", err) return } diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index bb1e9bb4b4..e1bdcc16e9 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -644,7 +644,7 @@ func (c *Clique) Seal(chain consensus.ChainReader, block *types.Block, stop <-ch } } // Sweet, the protocol permits us to sign the block, wait for our time - delay := time.Unix(header.Time.Int64(), 0).Sub(time.Now()) // nolint: gosimple + delay := time.Until(time.Unix(header.Time.Int64(), 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 diff --git a/eth/fetcher/fetcher.go b/eth/fetcher/fetcher.go index 7d1e15fd4d..ed362f0276 100644 --- a/eth/fetcher/fetcher.go +++ b/eth/fetcher/fetcher.go @@ -679,7 +679,7 @@ func (f *Fetcher) insert(peer string, block *types.Block) { go f.broadcastBlock(block, true) } case consensus.ErrFutureBlock: - delay := time.Unix(block.Time().Int64(), 0).Sub(time.Now()) // nolint: gosimple + delay := time.Until(time.Unix(block.Time().Int64(), 0)) log.Info("Receive future block", "number", block.NumberU64(), "hash", block.Hash().Hex(), "delay", delay) time.Sleep(delay) goto again