Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 57048c6

Browse files
dvushavalonche
authored andcommitted
fix statedb copy (#22)
1 parent 47e3fd9 commit 57048c6

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

miner/worker.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,9 @@ func (w *worker) commitTransaction(env *environment, tx *types.Transaction) ([]*
973973
stateDB = env.state
974974
}
975975

976+
// It's important to copy then .Prepare() - don't reorder.
977+
stateDB.Prepare(tx.Hash(), env.tcount)
978+
976979
snapshot := stateDB.Snapshot()
977980

978981
gasPrice, err := tx.EffectiveGasTip(env.header.BaseFee)
@@ -1060,8 +1063,6 @@ func (w *worker) commitBundle(env *environment, txs types.Transactions, interrup
10601063
log.Trace("Ignoring reply protected transaction", "hash", tx.Hash(), "eip155", w.chainConfig.EIP155Block)
10611064
return errCouldNotApplyTransaction
10621065
}
1063-
// Start executing the transaction
1064-
env.state.Prepare(tx.Hash(), env.tcount)
10651066

10661067
logs, err := w.commitTransaction(env, tx)
10671068
switch {
@@ -1384,7 +1385,6 @@ func (w *worker) fillTransactions(interrupt *int32, env *environment, validatorC
13841385
}
13851386
if tx != nil {
13861387
log.Info("Proposer payout create tx succeeded, proceeding to commit tx")
1387-
env.state.Prepare(tx.Hash(), env.tcount)
13881388
_, err = w.commitTransaction(env, tx)
13891389
if err != nil {
13901390
log.Error("Proposer payout commit tx failed", "hash", tx.Hash().String(), "err", err)

0 commit comments

Comments
 (0)