mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-24 08:49:29 +00:00
core/vm: fix create refunds
This commit is contained in:
parent
05315157c3
commit
6ed41d9d83
1 changed files with 6 additions and 3 deletions
|
|
@ -594,10 +594,13 @@ 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)
|
||||||
|
|
||||||
// On ExceptionalHalt, burn all remaining gas. On REVERT, preserve
|
// On ExceptionalHalt, burn remaining regular gas. On REVERT, preserve
|
||||||
// remaining regular gas (same as CALL paths).
|
// remaining regular gas. State gas is always preserved.
|
||||||
if err != ErrExecutionReverted {
|
if err != ErrExecutionReverted {
|
||||||
contract.UseGas(contract.Gas, evm.Config.Tracer, tracing.GasChangeCallFailedExecution)
|
if evm.Config.Tracer != nil && evm.Config.Tracer.OnGasChange != nil {
|
||||||
|
evm.Config.Tracer.OnGasChange(contract.Gas.RegularGas, 0, tracing.GasChangeCallFailedExecution)
|
||||||
|
}
|
||||||
|
contract.Gas.RegularGas = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret, address, contract.Gas, err
|
return ret, address, contract.Gas, err
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue