mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-07 07:28:40 +00:00
ore/state, eth/tracers: fix block access index in trace tx
This commit is contained in:
parent
4ce3458586
commit
394fe783c6
2 changed files with 12 additions and 15 deletions
|
|
@ -75,12 +75,16 @@ func (s *journalMutationState) add(kind journalMutationKind) {
|
||||||
s.counts.add(kind)
|
s.counts.add(kind)
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove drops one occurrence of the given mutation kind. It returns two
|
// remove drops one occurrence of the given mutation kind. It returns a flag
|
||||||
// booleans: kindEmpty is true when no entries of that kind remain for the
|
// indicating whether no entries of any kind remain.
|
||||||
// account, and stateEmpty is true when no entries of any kind remain.
|
func (s *journalMutationState) remove(kind journalMutationKind) bool {
|
||||||
func (s *journalMutationState) remove(kind journalMutationKind) (kindEmpty bool, stateEmpty bool) {
|
if s.counts.remove(kind) {
|
||||||
kindEmpty = s.counts.remove(kind)
|
// No entries of this kind remain for this account; drop the
|
||||||
return kindEmpty, s.counts == (journalMutationCounts{})
|
// corresponding stashed original so the state mirrors the
|
||||||
|
// live mutation set.
|
||||||
|
s.clearKind(kind)
|
||||||
|
}
|
||||||
|
return s.counts == (journalMutationCounts{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// clearKind drops the stashed original for the given mutation kind. It is
|
// clearKind drops the stashed original for the given mutation kind. It is
|
||||||
|
|
@ -295,14 +299,7 @@ func (j *journal) revert(statedb *StateDB, snapshot int) {
|
||||||
if state == nil {
|
if state == nil {
|
||||||
panic(fmt.Errorf("journal mutation tracking missing for %x", addr[:]))
|
panic(fmt.Errorf("journal mutation tracking missing for %x", addr[:]))
|
||||||
}
|
}
|
||||||
kindEmpty, stateEmpty := state.remove(kind)
|
if state.remove(kind) {
|
||||||
if kindEmpty {
|
|
||||||
// No entries of this kind remain for this account; drop the
|
|
||||||
// corresponding stashed original so the state mirrors the
|
|
||||||
// live mutation set.
|
|
||||||
state.clearKind(kind)
|
|
||||||
}
|
|
||||||
if stateEmpty {
|
|
||||||
delete(j.mutations, addr)
|
delete(j.mutations, addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1016,7 +1016,7 @@ func (api *API) traceTx(ctx context.Context, tx *types.Transaction, message *cor
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// Call Prepare to clear out the statedb access list
|
// Call Prepare to clear out the statedb access list
|
||||||
statedb.SetTxContext(txctx.TxHash, txctx.TxIndex, uint32(txctx.TxIndex))
|
statedb.SetTxContext(txctx.TxHash, txctx.TxIndex, uint32(txctx.TxIndex+1))
|
||||||
|
|
||||||
_, err = core.ApplyTransactionWithEVM(message, core.NewGasPool(message.GasLimit), statedb, vmctx.BlockNumber, txctx.BlockHash, vmctx.Time, tx, evm)
|
_, err = core.ApplyTransactionWithEVM(message, core.NewGasPool(message.GasLimit), statedb, vmctx.BlockNumber, txctx.BlockHash, vmctx.Time, tx, evm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue