From ac3def061b88a13e099c483c47722f3f168dfe42 Mon Sep 17 00:00:00 2001 From: Bernard Peh Date: Thu, 31 May 2018 20:21:26 +1000 Subject: [PATCH] do not need to check if recipient is contract or not --- lib/statemanager.js | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/lib/statemanager.js b/lib/statemanager.js index b8246af754..b73079ba2c 100644 --- a/lib/statemanager.js +++ b/lib/statemanager.js @@ -810,28 +810,9 @@ StateManager.prototype.createFakeTransactionWithCorrectNonce = function(rawTx, f } } - // If we're calling a contract, check to make sure the address specified is a contract address - if (_transactionIsContractCall(rawTx)) { - self.getCode(to.hex(rawTx.to), 'latest', function(err, code) { - if (err) { - callback(err); - } else if (code === '0x0') { - callback(new TXRejectedError(`Attempting to run transaction which calls a contract function, but recipient address ${to.hex(rawTx.to)} is not a contract address`)) - } else { - callback(null, tx) - } - }); - } else { - callback(null, tx) - } + callback(null, tx) + }); } -// returns true when transaction has a non-null, non-empty to and data field -var _transactionIsContractCall = function(rawTx) { - let recipient = to.hex(rawTx.to || '0x0') - let data = to.hex(rawTx.data || '0x0') - - return recipient !== '0x0' && data !== '0x0' -} module.exports = StateManager;