From 815995e9e0188798a8aee671412e9db3f35e14ad Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Mon, 3 Nov 2025 18:46:38 +0800 Subject: [PATCH] miner: fix inconsistent error evaluation, close XFN-60 (#1632) --- miner/worker.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/miner/worker.go b/miner/worker.go index e18d5bfa7a..fce6fda7cb 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -1018,15 +1018,15 @@ func (w *Work) commitTransactions(mux *event.TypeMux, balanceFee map[common.Addr continue } logs, tokenFeeUsed, gas, err := w.commitTransaction(balanceFee, tx, bc, coinbase, gp) - switch err { - case core.ErrNonceTooLow: + switch { + case errors.Is(err, core.ErrNonceTooLow): // New head notification data race between the transaction pool and miner, shift log.Trace("Skipping special transaction with low nonce", "sender", from, "nonce", tx.Nonce(), "to", to) - case core.ErrNonceTooHigh: + case errors.Is(err, core.ErrNonceTooHigh): // Reorg notification data race between the transaction pool and miner, skip account = log.Trace("Skipping account with special transaction hight nonce", "sender", from, "nonce", tx.Nonce(), "to", to) - case nil: + case errors.Is(err, nil): // Everything ok, collect the logs and shift in the next transaction from the same account coalescedLogs = append(coalescedLogs, logs...) w.tcount++