aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions.js
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2017-07-08 10:36:40 +0800
committerGitHub <noreply@github.com>2017-07-08 10:36:40 +0800
commit2d1b7c0ee152c38ebb0f3a63bd9f2daef18ded36 (patch)
treef55fc35f6409f0aee7573e4dbbfbb631a573a5e7 /app/scripts/controllers/transactions.js
parentfd6caf871368d2339f91ad6ae339062daf303d87 (diff)
parent512b6cae81ee0e71b567a72418ac224804dfc3e6 (diff)
downloadtangerine-wallet-browser-2d1b7c0ee152c38ebb0f3a63bd9f2daef18ded36.tar
tangerine-wallet-browser-2d1b7c0ee152c38ebb0f3a63bd9f2daef18ded36.tar.gz
tangerine-wallet-browser-2d1b7c0ee152c38ebb0f3a63bd9f2daef18ded36.tar.bz2
tangerine-wallet-browser-2d1b7c0ee152c38ebb0f3a63bd9f2daef18ded36.tar.lz
tangerine-wallet-browser-2d1b7c0ee152c38ebb0f3a63bd9f2daef18ded36.tar.xz
tangerine-wallet-browser-2d1b7c0ee152c38ebb0f3a63bd9f2daef18ded36.tar.zst
tangerine-wallet-browser-2d1b7c0ee152c38ebb0f3a63bd9f2daef18ded36.zip
Merge pull request #1757 from MetaMask/resubmit-fixv3.8.5
Resubmit fix
Diffstat (limited to 'app/scripts/controllers/transactions.js')
-rw-r--r--app/scripts/controllers/transactions.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js
index 41d70194e..18bb245de 100644
--- a/app/scripts/controllers/transactions.js
+++ b/app/scripts/controllers/transactions.js
@@ -417,23 +417,28 @@ module.exports = class TransactionController extends EventEmitter {
// only try resubmitting if their are transactions to resubmit
if (!pending.length) return
const resubmit = denodeify(this._resubmitTx.bind(this))
- pending.forEach((txMeta) => resubmit(txMeta)
- .catch((reason) => {
+ pending.forEach((txMeta) => resubmit(txMeta).catch((err) => {
/*
Dont marked as failed if the error is a "known" transaction warning
"there is already a transaction with the same sender-nonce
but higher/same gas price"
*/
- const errorMessage = reason.message.toLowerCase()
+ const errorMessage = err.message.toLowerCase()
const isKnownTx = (
// geth
errorMessage === 'replacement transaction underpriced'
|| errorMessage.startsWith('known transaction')
// parity
|| errorMessage === 'gas price too low to replace'
+ || errorMessage === 'transaction with the same hash was already imported.'
)
// ignore resubmit warnings, return early
- if (!isKnownTx) this.setTxStatusFailed(txMeta.id, reason.message)
+ if (isKnownTx) return
+ // encountered real error - transition to error state
+ this.setTxStatusFailed(txMeta.id, {
+ errCode: err.errCode || err,
+ message: err.message,
+ })
}))
}
@@ -448,7 +453,7 @@ module.exports = class TransactionController extends EventEmitter {
// if the value of the transaction is greater then the balance, fail.
if (gtBalance) {
const message = 'Insufficient balance.'
- this.setTxStatusFailed(txMeta.id, message)
+ this.setTxStatusFailed(txMeta.id, { message })
cb()
return log.error(message)
}
@@ -456,7 +461,7 @@ module.exports = class TransactionController extends EventEmitter {
// 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)
+ this.setTxStatusFailed(txMeta.id, { message })
cb()
return log.error(message)
}