mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
eth: return after ApplyMessage
The `statedb` is parent's, so it should be ApplyMessage, then with `statedb.Finalise` to get a new one.
This commit is contained in:
parent
4466c7b971
commit
e9f16278cf
1 changed files with 3 additions and 3 deletions
|
|
@ -653,9 +653,6 @@ func (api *PrivateDebugAPI) computeTxEnv(blockHash common.Hash, txIndex int, ree
|
||||||
// Assemble the transaction call message and return if the requested offset
|
// Assemble the transaction call message and return if the requested offset
|
||||||
msg, _ := tx.AsMessage(signer)
|
msg, _ := tx.AsMessage(signer)
|
||||||
context := core.NewEVMContext(msg, block.Header(), api.eth.blockchain, nil)
|
context := core.NewEVMContext(msg, block.Header(), api.eth.blockchain, nil)
|
||||||
if idx == txIndex {
|
|
||||||
return msg, context, statedb, nil
|
|
||||||
}
|
|
||||||
// Not yet the searched for transaction, execute on top of the current state
|
// Not yet the searched for transaction, execute on top of the current state
|
||||||
vmenv := vm.NewEVM(context, statedb, api.config, vm.Config{})
|
vmenv := vm.NewEVM(context, statedb, api.config, vm.Config{})
|
||||||
if _, _, _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(tx.Gas())); err != nil {
|
if _, _, _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(tx.Gas())); err != nil {
|
||||||
|
|
@ -663,6 +660,9 @@ func (api *PrivateDebugAPI) computeTxEnv(blockHash common.Hash, txIndex int, ree
|
||||||
}
|
}
|
||||||
// Ensure any modifications are committed to the state
|
// Ensure any modifications are committed to the state
|
||||||
statedb.Finalise(true)
|
statedb.Finalise(true)
|
||||||
|
if idx == txIndex {
|
||||||
|
return msg, context, statedb, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil, vm.Context{}, nil, fmt.Errorf("tx index %d out of range for block %x", txIndex, blockHash)
|
return nil, vm.Context{}, nil, fmt.Errorf("tx index %d out of range for block %x", txIndex, blockHash)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue