fix block 226522 problem

This commit is contained in:
andri lim 2019-02-21 13:33:45 +07:00 committed by zah
parent fa183e3a31
commit 4dc45550dd
2 changed files with 12 additions and 7 deletions

View File

@ -234,7 +234,10 @@ proc applyCreateMessage(fork: Fork, computation: var BaseComputation, opCode: st
snapshot.commit()
except OutOfGas:
if fork == FkFrontier:
debug "applyCreateMessage failed: ",
msg = getCurrentExceptionMsg(),
depth = computation.msg.depth
if fork < FkHomestead:
computation.output = @[]
else:
# Different from Frontier:
@ -271,6 +274,8 @@ proc addChildComputation(fork: Fork, computation: var BaseComputation, child: Ba
computation.returnData = @[]
else:
computation.returnData = child.output
for k, v in child.accountsToDelete:
computation.accountsToDelete[k] = v
computation.children.add(child)
proc getFork*(computation: BaseComputation): Fork =

View File

@ -801,16 +801,16 @@ op selfDestruct, inline = false:
computation.vmState.mutateStateDB:
let
local_balance = db.getBalance(computation.msg.storage_address)
beneficiary_balance = db.getBalance(beneficiary)
localBalance = db.getBalance(computation.msg.storageAddress)
beneficiaryBalance = db.getBalance(beneficiary)
# Transfer to beneficiary
db.setBalance(beneficiary, local_balance + beneficiary_balance)
db.setBalance(beneficiary, localBalance + beneficiaryBalance)
# Zero the balance of the address being deleted.
# This must come after sending to beneficiary in case the
# contract named itself as the beneficiary.
db.set_balance(computation.msg.storage_address, 0.u256)
db.setBalance(computation.msg.storageAddress, 0.u256)
# Register the account to be deleted
computation.registerAccountForDeletion(beneficiary)
@ -819,6 +819,6 @@ op selfDestruct, inline = false:
computation.gasMeter.refundGas(RefundSelfDestruct)
trace "SELFDESTRUCT",
storage_address = computation.msg.storage_address.toHex,
local_balance = local_balance.toString,
storageAddress = computation.msg.storageAddress.toHex,
localBalance = localBalance.toString,
beneficiary = beneficiary.toHex