Refactor for generateChildComputation

This commit is contained in:
coffeepots 2018-09-11 18:48:38 +01:00
parent 2b6342764c
commit 6183761251
1 changed files with 6 additions and 9 deletions

View File

@ -93,17 +93,14 @@ proc applyMessage(computation: BaseComputation): BaseComputation =
raise newException(NotImplementedError, "Apply message not implemented")
proc generateChildComputation*(computation: BaseComputation, childMsg: Message): BaseComputation =
new result
let childComp = newBaseComputation(
computation.vmState,
computation.vmState.blockHeader.blockNumber,
childMsg)
if childMsg.isCreate:
result = newBaseComputation(
computation.vmState,
computation.vmState.blockHeader.blockNumber,
childMsg).applyCreateMessage()
result = applyCreateMessage(childComp)
else:
result = newBaseComputation(
computation.vmState,
computation.vmState.blockHeader.blockNumber,
childMsg).applyMessage()
result = applyMessage(childComp)
proc addChildComputation(computation: BaseComputation, child: BaseComputation) =
if child.isError: