From 5c0fe4fc1e71739e3502aad93643a390f93dd6f4 Mon Sep 17 00:00:00 2001 From: NathanBSC Date: Wed, 7 Aug 2024 17:39:08 +0800 Subject: [PATCH] miner: ensure delayBlocksBroadcast loop started --- miner/worker.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/miner/worker.go b/miner/worker.go index ef12b141bf..61ecece73b 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -305,11 +305,8 @@ func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus go worker.newWorkLoop(recommit) go worker.resultLoop() go worker.taskLoop() - - if worker.config.MB.BroadcastDelayBlocks > 0 { - worker.wg.Add(1) - go worker.delayBlocksBroadcastLoop() - } + worker.wg.Add(1) + go worker.delayBlocksBroadcastLoop() // Submit first work to initialize pending state. if init { @@ -727,7 +724,7 @@ func (w *worker) delayBlocksBroadcastLoop() { defer w.wg.Done() for { - if len(w.delayedBlocksForBroadcast) > 0 { + if len(w.delayedBlocksForBroadcast) > 0 && w.config.MB.BroadcastDelayBlocks > 0 { w.delayedMu.Lock() currentBlock := w.chain.CurrentBlock()