move 'tx.getRecipient' into 'setupComputation'

This commit is contained in:
andri lim 2020-01-20 18:59:46 +07:00 committed by zah
parent 37c282f1b9
commit ec8abf40e4
2 changed files with 3 additions and 5 deletions

View File

@ -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

View File

@ -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,