diff --git a/lib/statemanager.js b/lib/statemanager.js index 9783de562f..e6525788be 100644 --- a/lib/statemanager.js +++ b/lib/statemanager.js @@ -880,29 +880,7 @@ StateManager.prototype.createFakeTransactionWithCorrectNonce = function(rawTx, f `tx has nonce of: ${to.number(tx.nonce)}`)) } } - - // 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; diff --git a/test/transaction_rejection.js b/test/transaction_rejection.js index 961b684ee2..098bdb7746 100644 --- a/test/transaction_rejection.js +++ b/test/transaction_rejection.js @@ -100,18 +100,6 @@ describe("Transaction rejection", function() { }, /sender doesn't have enough funds to send tx/, done) }); - it("should reject contract transaction if 'to' is not a contract address", function(done) { - let params = { - to: '0x0000000000000000000000001234000000000000' - } - - testTransactionForRejection( - params, - new RegExp(`Attempting to run transaction which calls a contract function, but recipient address ${params.to} is not a contract address`), - done - ) - }); - function testTransactionForRejection(paramsOverride, messageRegex, done) { let params = Object.assign({ from: accounts[0],