aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-09-19 05:34:25 +0800
committerDan Finlay <dan@danfinlay.com>2017-09-19 05:34:25 +0800
commit2b7b1db851e484cda68352a365215d49fa1c30aa (patch)
tree7b32bade1a526d8050b4b6c5679e4206dbf3c867 /app
parentc9ac8f09199ecbe37982b1ba1470c8aa03a139a0 (diff)
downloadtangerine-wallet-browser-2b7b1db851e484cda68352a365215d49fa1c30aa.tar
tangerine-wallet-browser-2b7b1db851e484cda68352a365215d49fa1c30aa.tar.gz
tangerine-wallet-browser-2b7b1db851e484cda68352a365215d49fa1c30aa.tar.bz2
tangerine-wallet-browser-2b7b1db851e484cda68352a365215d49fa1c30aa.tar.lz
tangerine-wallet-browser-2b7b1db851e484cda68352a365215d49fa1c30aa.tar.xz
tangerine-wallet-browser-2b7b1db851e484cda68352a365215d49fa1c30aa.tar.zst
tangerine-wallet-browser-2b7b1db851e484cda68352a365215d49fa1c30aa.zip
Do not mark a retry tx failed that has been broadcast successfully
Fixes #2115 If a tx has been braodcast, the only failures we should accept are: - Never mined - On chain failure We had a section of code that would mark a tx failed during any unknown error during a retry. Now no retry > 1 will ever mark a tx failed, since it has been broadcast, and may be mined.
Diffstat (limited to 'app')
-rw-r--r--app/scripts/lib/pending-tx-tracker.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/scripts/lib/pending-tx-tracker.js b/app/scripts/lib/pending-tx-tracker.js
index b90851b58..44e9d50fa 100644
--- a/app/scripts/lib/pending-tx-tracker.js
+++ b/app/scripts/lib/pending-tx-tracker.js
@@ -76,6 +76,9 @@ module.exports = class PendingTransactionTracker extends EventEmitter {
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"
+
+ Also don't mark as failed if it has ever been broadcast successfully.
+ A successful broadcast means it may still be mined.
*/
const errorMessage = err.message.toLowerCase()
const isKnownTx = (
@@ -88,6 +91,7 @@ module.exports = class PendingTransactionTracker extends EventEmitter {
// other
|| errorMessage.includes('gateway timeout')
|| errorMessage.includes('nonce too low')
+ || txMeta.retryCount > 1
)
// ignore resubmit warnings, return early
if (isKnownTx) return
@@ -117,10 +121,12 @@ module.exports = class PendingTransactionTracker extends EventEmitter {
// Only auto-submit already-signed txs:
if (!('rawTx' in txMeta)) return
- // Increment a try counter.
- txMeta.retryCount++
const rawTx = txMeta.rawTx
- return await this.publishTransaction(rawTx)
+ const txHash = await this.publishTransaction(rawTx)
+
+ // Increment successful tries:
+ txMeta.retryCount++
+ return txHash
}
async _checkPendingTx (txMeta) {