diff options
author | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2018-11-15 05:34:07 +0800 |
---|---|---|
committer | Frankie <frankie.diamond@gmail.com> | 2018-11-15 05:34:07 +0800 |
commit | 22ba0b0c2d4aee355893832dcbd9a5cd87cbf966 (patch) | |
tree | 077c21d0afb8e524b233622951ec822de0b22759 /app/scripts/controllers/transactions/pending-tx-tracker.js | |
parent | f6e042b7b12fec755b0a91ff24a1e812f65b638d (diff) | |
download | tangerine-wallet-browser-22ba0b0c2d4aee355893832dcbd9a5cd87cbf966.tar.gz tangerine-wallet-browser-22ba0b0c2d4aee355893832dcbd9a5cd87cbf966.tar.zst tangerine-wallet-browser-22ba0b0c2d4aee355893832dcbd9a5cd87cbf966.zip |
Resubmit approved transactions on new block (#5752)
* Add beginning of test
* Resubmit approved transactions on new block
May fix #4343 and related issues, where an error could leave
transactions stranded in the approved state.
* Remove unused test
* Re-approve transactions when retrying approved
* Add retry approved test
* Include approved in pending tx count
* Fix getPendingTxs()
* Linted
* Only throw hash error in submitted state
* Only check submitted txs for block inclusion
* Fix test expectations
Diffstat (limited to 'app/scripts/controllers/transactions/pending-tx-tracker.js')
-rw-r--r-- | app/scripts/controllers/transactions/pending-tx-tracker.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/scripts/controllers/transactions/pending-tx-tracker.js b/app/scripts/controllers/transactions/pending-tx-tracker.js index 70cac096b..44a50a589 100644 --- a/app/scripts/controllers/transactions/pending-tx-tracker.js +++ b/app/scripts/controllers/transactions/pending-tx-tracker.js @@ -27,6 +27,7 @@ class PendingTransactionTracker extends EventEmitter { this.getPendingTransactions = config.getPendingTransactions this.getCompletedTransactions = config.getCompletedTransactions this.publishTransaction = config.publishTransaction + this.approveTransaction = config.approveTransaction this.confirmTransaction = config.confirmTransaction } @@ -108,7 +109,7 @@ class PendingTransactionTracker extends EventEmitter { if (txBlockDistance <= Math.pow(2, retryCount) - 1) return // Only auto-submit already-signed txs: - if (!('rawTx' in txMeta)) return + if (!('rawTx' in txMeta)) return this.approveTransaction(txMeta.id) const rawTx = txMeta.rawTx const txHash = await this.publishTransaction(rawTx) @@ -129,6 +130,9 @@ class PendingTransactionTracker extends EventEmitter { const txHash = txMeta.hash const txId = txMeta.id + // Only check submitted txs + if (txMeta.status !== 'submitted') return + // extra check in case there was an uncaught error during the // signature and submission process if (!txHash) { |