From ddcefc8149def91600599bbc6585317730e84242 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Thu, 22 Feb 2024 16:56:26 +0700 Subject: [PATCH] miner/worker: skip resubmit logic in Consortium Currently, after 3 seconds, worker tries to create another block, optimistically thinks that it can get more transactions and earns more fee as a result. However, this causes overhead to the main block creating flow, so skip this logic in Consortium. --- miner/worker.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/miner/worker.go b/miner/worker.go index 4b8a31d9b1..3e229cd04f 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -450,7 +450,8 @@ func (w *worker) newWorkLoop(recommit time.Duration) { case <-timer.C: // If mining is running resubmit a new work cycle periodically to pull in // higher priced transactions. Disable this overhead for pending blocks. - if w.isRunning() && (w.chainConfig.Clique == nil || w.chainConfig.Clique.Period > 0) { + if w.isRunning() && + (w.chainConfig.Consortium == nil || w.chainConfig.Clique == nil || w.chainConfig.Clique.Period > 0) { // Short circuit if no new transaction arrives. if atomic.LoadInt32(&w.newTxs) == 0 { timer.Reset(recommit)