diff options
author | Dan Finlay <flyswatter@users.noreply.github.com> | 2017-07-07 01:03:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-07 01:03:06 +0800 |
commit | 33c2b864db8d92a1c7904b1c1e4bbc3ad5d73e31 (patch) | |
tree | b08ba5ad7da8d772530687d096f2f184b0dd0d91 /app | |
parent | 8201ae1b53f7be60cf61351905e3dba21f2f39f8 (diff) | |
parent | b87d10ab1dff539c4cb32ab32ccc1069598fb11b (diff) | |
download | tangerine-wallet-browser-33c2b864db8d92a1c7904b1c1e4bbc3ad5d73e31.tar tangerine-wallet-browser-33c2b864db8d92a1c7904b1c1e4bbc3ad5d73e31.tar.gz tangerine-wallet-browser-33c2b864db8d92a1c7904b1c1e4bbc3ad5d73e31.tar.bz2 tangerine-wallet-browser-33c2b864db8d92a1c7904b1c1e4bbc3ad5d73e31.tar.lz tangerine-wallet-browser-33c2b864db8d92a1c7904b1c1e4bbc3ad5d73e31.tar.xz tangerine-wallet-browser-33c2b864db8d92a1c7904b1c1e4bbc3ad5d73e31.tar.zst tangerine-wallet-browser-33c2b864db8d92a1c7904b1c1e4bbc3ad5d73e31.zip |
Merge pull request #1747 from MetaMask/FailingTestForFailingLowBalanceTx
Fail txs on retry if balance is insufficient
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/controllers/transactions.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js index 52251d66e..7946d10d1 100644 --- a/app/scripts/controllers/transactions.js +++ b/app/scripts/controllers/transactions.js @@ -428,10 +428,22 @@ module.exports = class TransactionController extends EventEmitter { const gtBalance = Number.parseInt(txMeta.txParams.value) > Number.parseInt(balance) if (!('retryCount' in txMeta)) txMeta.retryCount = 0 - // if the value of the transaction is greater then the balance - // or the nonce of the transaction is lower then the accounts nonce - // dont resubmit the tx - if (gtBalance || txNonce < nonce) return cb() + // if the value of the transaction is greater then the balance, fail. + if (gtBalance) { + const message = 'Insufficient balance.' + this.setTxStatusFailed(txMeta.id, message) + cb() + return log.error(message) + } + + // if the nonce of the transaction is lower then the accounts nonce, fail. + if (txNonce < nonce) { + const message = 'Invalid nonce.' + this.setTxStatusFailed(txMeta.id, message) + cb() + return log.error(message) + } + // Only auto-submit already-signed txs: if (!('rawTx' in txMeta)) return cb() |