diff --git a/miner/worker.go b/miner/worker.go index 7c0ff5f7fdc53..3546f7c07d09e 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -973,6 +973,9 @@ func (w *worker) commitTransaction(env *environment, tx *types.Transaction) ([]* stateDB = env.state } + // It's important to copy then .Prepare() - don't reorder. + stateDB.Prepare(tx.Hash(), env.tcount) + snapshot := stateDB.Snapshot() gasPrice, err := tx.EffectiveGasTip(env.header.BaseFee) @@ -1060,8 +1063,6 @@ func (w *worker) commitBundle(env *environment, txs types.Transactions, interrup log.Trace("Ignoring reply protected transaction", "hash", tx.Hash(), "eip155", w.chainConfig.EIP155Block) return errCouldNotApplyTransaction } - // Start executing the transaction - env.state.Prepare(tx.Hash(), env.tcount) logs, err := w.commitTransaction(env, tx) switch { @@ -1384,7 +1385,6 @@ func (w *worker) fillTransactions(interrupt *int32, env *environment, validatorC } if tx != nil { log.Info("Proposer payout create tx succeeded, proceeding to commit tx") - env.state.Prepare(tx.Hash(), env.tcount) _, err = w.commitTransaction(env, tx) if err != nil { log.Error("Proposer payout commit tx failed", "hash", tx.Hash().String(), "err", err)