diff --git a/core/vm/evm.go b/core/vm/evm.go index a04258b0df22..9dec6abf56a1 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -529,10 +529,12 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64, } } - if err == nil && evm.chainRules.IsPrague { - if !contract.UseGas(evm.Accesses.TouchAndChargeContractCreateCompleted(address.Bytes()[:])) { - evm.StateDB.RevertToSnapshot(snapshot) - err = ErrOutOfGas + if evm.chainRules.IsPrague { + if err == nil || err == ErrExecutionReverted { + if !contract.UseGas(evm.Accesses.TouchAndChargeContractCreateCompleted(address.Bytes()[:])) { + evm.StateDB.RevertToSnapshot(snapshot) + err = ErrOutOfGas + } } }