miner: fix BAL mutation tracking in applyTransaction

The WithReader() call creates a deep copy (Copy()) of the StateDB
per-tx. Mutations are captured from the copy, but the copy is
discarded — so env.state never accumulates state changes across txs.
This causes coinbase balance in BAL entries to not reflect priority
fee accumulation from prior transactions.

Fix: remove the stateCopy/WithReader path. Execute directly on
env.state (which already has a tracked reader from makeEnv), matching
the sequential state processor's approach.
This commit is contained in:
qu0b 2026-03-24 11:40:59 +00:00
parent 8461385e0d
commit f16dd7e07f

View file

@ -442,12 +442,6 @@ func (miner *Miner) applyTransaction(env *environment, tx *types.Transaction) (*
snap = env.state.Snapshot()
gp = env.gasPool.Snapshot()
)
var stateCopy *state.StateDB
if env.accessList != nil {
stateCopy = env.state.WithReader(state.NewReaderWithTracker(env.state.Reader()))
env.evm.StateDB = stateCopy
}
mutations, receipt, err := core.ApplyTransaction(env.evm, env.gasPool, env.state, env.header, tx)
if err != nil {
if env.accessList != nil {