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

Commit a131085

Browse files
dvushavalonche
authored andcommitted
fix statedb copy (#22)
1 parent 9934902 commit a131085

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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 {
@@ -1385,7 +1386,6 @@ func (w *worker) fillTransactions(interrupt *int32, env *environment, validatorC
13851386
}
13861387
if tx != nil {
13871388
log.Info("Proposer payout create tx succeeded, proceeding to commit tx")
1388-
env.state.Prepare(tx.Hash(), env.tcount)
13891389
_, err = w.commitTransaction(env, tx)
13901390
if err != nil {
13911391
log.Error("Proposer payout commit tx failed", "hash", tx.Hash().String(), "err", err)

0 commit comments

Comments
 (0)