From 6fffb61bc183faa26a5357f352d11308f5691b16 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Tue, 18 Jun 2019 13:55:35 +0200 Subject: [PATCH] miner: don't update pending state when no transactions are added --- miner/worker.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/miner/worker.go b/miner/worker.go index 64ac21ccd3..c4b5cbc625 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -463,8 +463,13 @@ func (w *worker) mainLoop() { txs[acc] = append(txs[acc], tx) } txset := types.NewTransactionsByPriceAndNonce(w.current.signer, txs) + tcount := w.current.tcount w.commitTransactions(txset, coinbase, nil) - w.updateSnapshot() + // Only update the snapshot if any new transactons were added + // to the pending block + if tcount != w.current.tcount { + w.updateSnapshot() + } } else { // If clique is running in dev mode(period is 0), disable // advance sealing here.