Skip to content

Commit 2d20fed

Browse files
authored
miner: avoid data race in miner (ethereum#24349)
1 parent 6ce4670 commit 2d20fed

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

miner/worker.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,9 @@ func (w *worker) commit(env *environment, interval func(), update bool, start ti
11341134
if interval != nil {
11351135
interval()
11361136
}
1137+
// Create a local environment copy, avoid the data race with snapshot state.
1138+
// https://github.com/ethereum/go-ethereum/issues/24299
1139+
env := env.copy()
11371140
block, err := w.engine.FinalizeAndAssemble(w.chain, env.header, env.state, env.txs, env.unclelist(), env.receipts)
11381141
if err != nil {
11391142
return err

0 commit comments

Comments
 (0)