From 2ce03ad41a30acf89c58f28792f63747a55107f1 Mon Sep 17 00:00:00 2001 From: Qi Zhou Date: Fri, 11 Mar 2022 21:53:36 -0800 Subject: [PATCH] enable pending block (#49) Co-authored-by: Qi Zhou --- miner/worker.go | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/miner/worker.go b/miner/worker.go index 2793a24c0c57..3c1d740eef0b 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -433,7 +433,6 @@ func (w *worker) newWorkLoop(recommit time.Duration) { defer timer.Stop() <-timer.C // discard the initial tick - _, isTm := w.engine.(*tendermint.Tendermint) // commit aborts in-flight transaction execution with given signal and resubmits a new one. commit := func(noempty bool, s int32) { if interrupt != nil { @@ -464,26 +463,16 @@ func (w *worker) newWorkLoop(recommit time.Duration) { case <-w.startCh: clearPending(w.chain.CurrentBlock().NumberU64()) - if isTm { - continue - } - timestamp = time.Now().Unix() commit(false, commitInterruptNewHead) case head := <-w.chainHeadCh: - clearPending(head.Block.NumberU64()) - if isTm { - continue - } + timestamp = time.Now().Unix() commit(false, commitInterruptNewHead) case <-timer.C: - if isTm { - continue - } // If sealing 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) { @@ -496,9 +485,6 @@ func (w *worker) newWorkLoop(recommit time.Duration) { } case interval := <-w.resubmitIntervalCh: - if isTm { - continue - } // Adjust resubmit interval explicitly by user. if interval < minRecommitInterval { log.Warn("Sanitizing miner recommit interval", "provided", interval, "updated", minRecommitInterval) @@ -512,9 +498,6 @@ func (w *worker) newWorkLoop(recommit time.Duration) { } case adjust := <-w.resubmitAdjustCh: - if isTm { - continue - } // Adjust resubmit interval by feedback. if adjust.inc { before := recommit @@ -1161,7 +1144,8 @@ func (w *worker) commitWork(interrupt *int32, noempty bool, timestamp int64) { // Note the assumption is held that the mutation is allowed to the passed env, do // the deep copy first. func (w *worker) commit(env *environment, interval func(), update bool, start time.Time) error { - if w.isRunning() { + _, isTm := w.engine.(*tendermint.Tendermint) + if w.isRunning() && !isTm { if interval != nil { interval() }