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

View File

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