mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 19:30:44 +00:00
core/vm: fix state gas refund logic
This commit is contained in:
parent
923e807372
commit
47f5715f86
1 changed files with 5 additions and 3 deletions
|
|
@ -606,9 +606,11 @@ func (evm *EVM) create(caller common.Address, code []byte, gas GasCosts, value *
|
||||||
if err != nil && (evm.chainRules.IsHomestead || err != ErrCodeStoreOutOfGas) {
|
if err != nil && (evm.chainRules.IsHomestead || err != ErrCodeStoreOutOfGas) {
|
||||||
evm.StateDB.RevertToSnapshot(snapshot)
|
evm.StateDB.RevertToSnapshot(snapshot)
|
||||||
|
|
||||||
contract.UseGas(contract.Gas, evm.Config.Tracer, tracing.GasChangeCallFailedExecution)
|
// On ExceptionalHalt, burn all remaining gas. On REVERT, preserve
|
||||||
// State changes are rolled back, so state gas charges from the
|
// remaining regular gas (same as CALL paths).
|
||||||
// reverted execution should not count toward block accounting.
|
if err != ErrExecutionReverted {
|
||||||
|
contract.UseGas(contract.Gas, evm.Config.Tracer, tracing.GasChangeCallFailedExecution)
|
||||||
|
}
|
||||||
// Restore gas to the parent on child error
|
// Restore gas to the parent on child error
|
||||||
contract.Gas.StateGas += contract.Gas.StateGasCharged
|
contract.Gas.StateGas += contract.Gas.StateGasCharged
|
||||||
contract.Gas.StateGasCharged = 0
|
contract.Gas.StateGasCharged = 0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue