Skip to content

Commit

Permalink
miner: avoid data race in miner (ethereum#24349)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 authored and jagdeep sidhu committed Feb 11, 2022
1 parent e670cf5 commit e5ab6d7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions miner/worker.go
Expand Up @@ -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
Expand Down

0 comments on commit e5ab6d7

Please sign in to comment.