Skip to content

Commit

Permalink
miner: ensure delayBlocksBroadcast loop started
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanBSC committed Aug 13, 2024
1 parent 8d78174 commit 9a923e0
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 9a923e0

Please sign in to comment.