From 78831e067791804b68bf322092d2ab87bfc181fa Mon Sep 17 00:00:00 2001 From: setunapo Date: Wed, 16 Nov 2022 22:30:51 +0800 Subject: [PATCH] worker: fix a bug of the delay timer. `fillTransactions` will call `commitTransactions` twice, if the delay timer is expired during the first call, it will make the delay timer never be triggered in the second commitTransactions call. Pseudo code: x := time.NewTimer(time.Second) <-x.C fmt.Println("read delay 1") <-x.C fmt.Println("read delay 2") // will never hit --- miner/worker.go | 1 + 1 file changed, 1 insertion(+) diff --git a/miner/worker.go b/miner/worker.go index 2d43f6c866..1d44ee0fa5 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -809,6 +809,7 @@ LOOP: select { case <-stopTimer.C: log.Info("Not enough time for further transactions", "txs", len(env.txs)) + stopTimer.Reset(0) // re-active the timer, in case it will be used later. break LOOP default: }