fix self destruct refund gas problem
This commit is contained in:
parent
90924eef47
commit
1ad4e256b2
|
@ -827,9 +827,6 @@ op selfDestruct, inline = false:
|
||||||
|
|
||||||
# Register the account to be deleted
|
# Register the account to be deleted
|
||||||
computation.registerAccountForDeletion(beneficiary)
|
computation.registerAccountForDeletion(beneficiary)
|
||||||
# FIXME: hook this into actual RefundSelfDestruct
|
|
||||||
let RefundSelfDestruct = 24_000
|
|
||||||
computation.gasMeter.refundGas(RefundSelfDestruct)
|
|
||||||
|
|
||||||
trace "SELFDESTRUCT",
|
trace "SELFDESTRUCT",
|
||||||
storageAddress = computation.msg.storageAddress.toHex,
|
storageAddress = computation.msg.storageAddress.toHex,
|
||||||
|
|
|
@ -70,8 +70,14 @@ proc execComputation*(computation: var BaseComputation): bool =
|
||||||
result = computation.applyMessage(Call)
|
result = computation.applyMessage(Call)
|
||||||
|
|
||||||
computation.vmState.mutateStateDB:
|
computation.vmState.mutateStateDB:
|
||||||
|
var suicidedCount = 0
|
||||||
for deletedAccount in computation.accountsForDeletion:
|
for deletedAccount in computation.accountsForDeletion:
|
||||||
db.deleteAccount deletedAccount
|
db.deleteAccount deletedAccount
|
||||||
|
inc suicidedCount
|
||||||
|
|
||||||
|
# FIXME: hook this into actual RefundSelfDestruct
|
||||||
|
const RefundSelfDestruct = 24_000
|
||||||
|
computation.gasMeter.refundGas(RefundSelfDestruct * suicidedCount)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
computation.vmState.addLogs(computation.logEntries)
|
computation.vmState.addLogs(computation.logEntries)
|
||||||
|
|
Loading…
Reference in New Issue