Merge branch 'jangko-fix_refund'

This commit is contained in:
Ștefan Talpalaru 2019-03-28 15:08:09 +01:00
commit b5a6456204
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
2 changed files with 6 additions and 3 deletions

View File

@ -827,9 +827,6 @@ op selfDestruct, inline = false:
# Register the account to be deleted
computation.registerAccountForDeletion(beneficiary)
# FIXME: hook this into actual RefundSelfDestruct
let RefundSelfDestruct = 24_000
computation.gasMeter.refundGas(RefundSelfDestruct)
trace "SELFDESTRUCT",
storageAddress = computation.msg.storageAddress.toHex,

View File

@ -70,8 +70,14 @@ proc execComputation*(computation: var BaseComputation): bool =
result = computation.applyMessage(Call)
computation.vmState.mutateStateDB:
var suicidedCount = 0
for deletedAccount in computation.accountsForDeletion:
db.deleteAccount deletedAccount
inc suicidedCount
# FIXME: hook this into actual RefundSelfDestruct
const RefundSelfDestruct = 24_000
computation.gasMeter.refundGas(RefundSelfDestruct * suicidedCount)
if result:
computation.vmState.addLogs(computation.logEntries)