mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
core/vm: in selfdestruct gas calculation, return early if there isn't enough gas to cover cold account access costs
This commit is contained in:
parent
ffe9dc97e5
commit
8f967299c4
1 changed files with 5 additions and 0 deletions
|
|
@ -230,7 +230,12 @@ func makeSelfdestructGasFn(refundsEnabled bool) gasFunc {
|
|||
// If the caller cannot afford the cost, this change will be rolled back
|
||||
evm.StateDB.AddAddressToAccessList(address)
|
||||
gas = params.ColdAccountAccessCostEIP2929
|
||||
|
||||
if contract.Gas < gas {
|
||||
return gas, nil
|
||||
}
|
||||
}
|
||||
|
||||
// if empty and transfers value
|
||||
if evm.StateDB.Empty(address) && evm.StateDB.GetBalance(contract.Address()).Sign() != 0 {
|
||||
gas += params.CreateBySelfdestructGas
|
||||
|
|
|
|||
Loading…
Reference in a new issue