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 Mar 9, 2023
1 parent bf900e9 commit 01d38b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions miner/worker.go
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 @@ -1385,7 +1386,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 01d38b5

Please sign in to comment.