core/vm: return early in selfdestruct gas calculation #33450 (#1959)

This commit is contained in:
Daniel Liu 2026-01-19 16:34:58 +08:00 committed by GitHub
parent cb48e25ccf
commit fcd9685c87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -237,6 +237,10 @@ 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 {