miner: avoid data race in miner (#24349)

pull/24353/head
rjl493456442 3 years ago committed by GitHub
parent 6ce4670bc0
commit 2d20fed893
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      miner/worker.go

@ -1134,6 +1134,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

Loading…
Cancel
Save