Skip to content

Commit

Permalink
fix statedb copy (ethereum#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvush authored and avalonche committed Feb 6, 2023
1 parent 47e3fd9 commit 57048c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 57048c6

Please sign in to comment.