From a112ed9911586bbde42dac66fa3e02169a7159c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Faruk=20Irmak?= Date: Thu, 11 Jul 2024 11:51:02 +0300 Subject: [PATCH] fix: return early as expected when engine.Prepare fails (#886) --- miner/scroll_worker.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/miner/scroll_worker.go b/miner/scroll_worker.go index 08bf4e315033..036718062a3b 100644 --- a/miner/scroll_worker.go +++ b/miner/scroll_worker.go @@ -373,12 +373,12 @@ func (w *worker) startNewPipeline(timestamp int64) { header.Coinbase = w.coinbase } - common.WithTimer(prepareTimer, func() { - if err := w.engine.Prepare(w.chain, header); err != nil { - log.Error("Failed to prepare header for mining", "err", err) - return - } - }) + prepareStart := time.Now() + if err := w.engine.Prepare(w.chain, header); err != nil { + log.Error("Failed to prepare header for mining", "err", err) + return + } + prepareTimer.UpdateSince(prepareStart) // If we are care about TheDAO hard-fork check whether to override the extra-data or not if daoBlock := w.chainConfig.DAOForkBlock; daoBlock != nil {