diff options
author | frankiebee <frankie.diamond@gmail.com> | 2017-09-27 13:42:59 +0800 |
---|---|---|
committer | frankiebee <frankie.diamond@gmail.com> | 2017-09-27 13:42:59 +0800 |
commit | 0a94ec41d3a2877ed7cfd3c8f9e9f9d725659183 (patch) | |
tree | adb50d0379a853b8dec9bd6a6bb298ae320b7b27 /app | |
parent | b05a6f89cb2c4de1e53d96f8cac01653a8165555 (diff) | |
download | tangerine-wallet-browser-0a94ec41d3a2877ed7cfd3c8f9e9f9d725659183.tar tangerine-wallet-browser-0a94ec41d3a2877ed7cfd3c8f9e9f9d725659183.tar.gz tangerine-wallet-browser-0a94ec41d3a2877ed7cfd3c8f9e9f9d725659183.tar.bz2 tangerine-wallet-browser-0a94ec41d3a2877ed7cfd3c8f9e9f9d725659183.tar.lz tangerine-wallet-browser-0a94ec41d3a2877ed7cfd3c8f9e9f9d725659183.tar.xz tangerine-wallet-browser-0a94ec41d3a2877ed7cfd3c8f9e9f9d725659183.tar.zst tangerine-wallet-browser-0a94ec41d3a2877ed7cfd3c8f9e9f9d725659183.zip |
pending-tx - move incrementing of the retryCount on the txMeta outside pending-tx-tracker
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/controllers/transactions.js | 5 | ||||
-rw-r--r-- | app/scripts/lib/pending-tx-tracker.js | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js index 6ea2933dc..3cd107031 100644 --- a/app/scripts/controllers/transactions.js +++ b/app/scripts/controllers/transactions.js @@ -75,6 +75,11 @@ module.exports = class TransactionController extends EventEmitter { this.pendingTxTracker.on('tx:warning', this.txStateManager.updateTx.bind(this.txStateManager)) this.pendingTxTracker.on('tx:failed', this.txStateManager.setTxStatusFailed.bind(this.txStateManager)) this.pendingTxTracker.on('tx:confirmed', this.txStateManager.setTxStatusConfirmed.bind(this.txStateManager)) + this.pendingTxTracker.on('tx:retry', (txMeta) => { + if (!('retryCount' in txMeta)) txMeta.retryCount = 0 + txMeta.retryCount++ + this.txStateManager.updateTx(txMeta) + }) this.blockTracker.on('rawBlock', this.pendingTxTracker.checkForTxInBlock.bind(this.pendingTxTracker)) // this is a little messy but until ethstore has been either diff --git a/app/scripts/lib/pending-tx-tracker.js b/app/scripts/lib/pending-tx-tracker.js index 31cf9babb..b07a6bd39 100644 --- a/app/scripts/lib/pending-tx-tracker.js +++ b/app/scripts/lib/pending-tx-tracker.js @@ -102,7 +102,6 @@ module.exports = class PendingTransactionTracker extends EventEmitter { const address = txMeta.txParams.from const balance = this.getBalance(address) if (balance === undefined) return - if (!('retryCount' in txMeta)) txMeta.retryCount = 0 if (txMeta.retryCount > this.retryLimit) { const err = new Error(`Gave up submitting after ${this.retryLimit} blocks un-mined.`) @@ -124,7 +123,7 @@ module.exports = class PendingTransactionTracker extends EventEmitter { const txHash = await this.publishTransaction(rawTx) // Increment successful tries: - txMeta.retryCount++ + this.emit('tx:retry', txMeta) return txHash } |