diff options
author | Howard Braham <howrad@gmail.com> | 2018-09-29 02:01:34 +0800 |
---|---|---|
committer | Howard Braham <howrad@gmail.com> | 2018-10-10 06:31:25 +0800 |
commit | 4cc0b1ef01573e1541d18bdcd89650e1db32ae9a (patch) | |
tree | b362504595ff4c7c233dc958de11a82d88ef8b79 /app | |
parent | 222e62d7f10ffe22dd606aea9c15e1547986c4ab (diff) | |
download | tangerine-wallet-browser-4cc0b1ef01573e1541d18bdcd89650e1db32ae9a.tar tangerine-wallet-browser-4cc0b1ef01573e1541d18bdcd89650e1db32ae9a.tar.gz tangerine-wallet-browser-4cc0b1ef01573e1541d18bdcd89650e1db32ae9a.tar.bz2 tangerine-wallet-browser-4cc0b1ef01573e1541d18bdcd89650e1db32ae9a.tar.lz tangerine-wallet-browser-4cc0b1ef01573e1541d18bdcd89650e1db32ae9a.tar.xz tangerine-wallet-browser-4cc0b1ef01573e1541d18bdcd89650e1db32ae9a.tar.zst tangerine-wallet-browser-4cc0b1ef01573e1541d18bdcd89650e1db32ae9a.zip |
ganache-core merged my PR, so I changed some comments to clarify that ganache-core v2.2.1 and below will return the non-standard '0x0'
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/controllers/transactions/tx-gas-utils.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/scripts/controllers/transactions/tx-gas-utils.js b/app/scripts/controllers/transactions/tx-gas-utils.js index 5ec728085..ac57dfe1d 100644 --- a/app/scripts/controllers/transactions/tx-gas-utils.js +++ b/app/scripts/controllers/transactions/tx-gas-utils.js @@ -63,14 +63,15 @@ class TxGasUtil { const hasRecipient = Boolean(recipient) if (hasRecipient) { - let code = await this.query.getCode(recipient) + const code = await this.query.getCode(recipient) // If there's data in the params, but there's no code, it's not a valid contract - // For no code, Infura will return '0x', and Ganache will return '0x0' + // For no code, Infura will return '0x', and ganache-core v2.2.1 will return '0x0' if (txParams.data && (!code || code === '0x' || code === '0x0')) { - throw {errorKey: TRANSACTION_NO_CONTRACT_ERROR_KEY} - } - else if (!code) { + const err = new Error() + err.errorKey = TRANSACTION_NO_CONTRACT_ERROR_KEY + throw err + } else if (!code) { txParams.gas = SIMPLE_GAS_COST // For a standard ETH send, gas is 21k max txMeta.simpleSend = true // Prevents buffer addition return SIMPLE_GAS_COST |