bugfix: block 78458 crash

This commit is contained in:
andri lim 2019-02-16 14:43:24 +07:00 committed by zah
parent 282824cd53
commit a1242d2538
1 changed files with 15 additions and 1 deletions

View File

@ -224,6 +224,11 @@ proc generateChildComputation*(fork: Fork, computation: BaseComputation, childMs
# Copy the fork op code executor proc (assumes child computation is in the same fork) # Copy the fork op code executor proc (assumes child computation is in the same fork)
childComp.opCodeExec = computation.opCodeExec childComp.opCodeExec = computation.opCodeExec
# TODO: use AccountStateDB revert/commit after JournalDB implemented
let stateDb = computation.vmState.accountDb
let intermediateRoot = stateDb.rootHash
computation.vmState.blockHeader.stateRoot = stateDb.rootHash
try: try:
if childMsg.isCreate: if childMsg.isCreate:
fork.applyCreateMessage(childComp, opCode) fork.applyCreateMessage(childComp, opCode)
@ -236,7 +241,16 @@ proc generateChildComputation*(fork: Fork, computation: BaseComputation, childMs
# param # param
type ErrorT = vm_types.Error type ErrorT = vm_types.Error
childComp.error = ErrorT(info: getCurrentExceptionMsg()) childComp.error = ErrorT(info: getCurrentExceptionMsg())
debug "applyMesage() failed", error = getCurrentExceptionMsg() if childMsg.isCreate:
debug "childComputation: createMessage() failed", error = getCurrentExceptionMsg()
else:
debug "childComputation: applyMessage() failed", error = getCurrentExceptionMsg()
if childComp.isError:
stateDb.rootHash = intermediateRoot
computation.vmState.blockHeader.stateRoot = intermediateRoot
else:
stateDb.rootHash = computation.vmState.blockHeader.stateRoot
return childComp return childComp