From ec8abf40e46a3192dccae13d8d999a289b8777be Mon Sep 17 00:00:00 2001 From: andri lim Date: Mon, 20 Jan 2020 18:59:46 +0700 Subject: [PATCH] move 'tx.getRecipient' into 'setupComputation' --- nimbus/p2p/executor.nim | 4 +--- nimbus/vm_state_transactions.nim | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/nimbus/p2p/executor.nim b/nimbus/p2p/executor.nim index 5b704171b..02c33a5ca 100644 --- a/nimbus/p2p/executor.nim +++ b/nimbus/p2p/executor.nim @@ -28,9 +28,7 @@ proc processTransaction*(tx: Transaction, sender: EthAddress, vmState: BaseVMSta var balance = vmState.readOnlyStateDb().getBalance(sender) if balance < upfrontGasCost: break - let recipient = tx.getRecipient() - - var c = setupComputation(vmState, tx, sender, recipient, fork) + var c = setupComputation(vmState, tx, sender, fork) if c.isNil: # OOG in setupComputation gasUsed = 0 break diff --git a/nimbus/vm_state_transactions.nim b/nimbus/vm_state_transactions.nim index 0a0920d8e..aefcbb924 100644 --- a/nimbus/vm_state_transactions.nim +++ b/nimbus/vm_state_transactions.nim @@ -26,7 +26,7 @@ proc validateTransaction*(vmState: BaseVMState, tx: Transaction, sender: EthAddr tx.accountNonce == account.nonce and account.balance >= gasCost -proc setupComputation*(vmState: BaseVMState, tx: Transaction, sender, recipient: EthAddress, fork: Fork) : Computation = +proc setupComputation*(vmState: BaseVMState, tx: Transaction, sender: EthAddress, fork: Fork) : Computation = var gas = tx.gasLimit - tx.intrinsicGas(fork) # TODO: refactor message to use byterange @@ -55,7 +55,7 @@ proc setupComputation*(vmState: BaseVMState, tx: Transaction, sender, recipient: depth: 0, gas: gas, sender: sender, - contractAddress: recipient, + contractAddress: tx.getRecipient(), codeAddress: tx.to, value: tx.value, data: data,