diff --git a/miner/worker.go b/miner/worker.go index a5e1f94a1889c..f40de12df798b 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -1142,6 +1142,9 @@ func (w *worker) commit(env *environment, interval func(), update bool, start ti if interval != nil { interval() } + // Create a local environment copy, avoid the data race with snapshot state. + // https://github.com/ethereum/go-ethereum/issues/24299 + env := env.copy() block, err := w.engine.FinalizeAndAssemble(w.chain, env.header, env.state, env.txs, env.unclelist(), env.receipts) if err != nil { return err