diff options
author | frankiebee <frankie.diamond@gmail.com> | 2017-09-13 03:19:26 +0800 |
---|---|---|
committer | frankiebee <frankie.diamond@gmail.com> | 2017-09-13 03:19:26 +0800 |
commit | 9e0c0745ab0f2aa207b0c062ad11efd8df1bb6c5 (patch) | |
tree | 580a22a2923d7cab5e75e8554e9b07d2c7c3bdc1 /app/scripts/lib/pending-tx-tracker.js | |
parent | 3ad67d1b14b5b56002cf34ab6dbb18d602705827 (diff) | |
download | tangerine-wallet-browser-9e0c0745ab0f2aa207b0c062ad11efd8df1bb6c5.tar tangerine-wallet-browser-9e0c0745ab0f2aa207b0c062ad11efd8df1bb6c5.tar.gz tangerine-wallet-browser-9e0c0745ab0f2aa207b0c062ad11efd8df1bb6c5.tar.bz2 tangerine-wallet-browser-9e0c0745ab0f2aa207b0c062ad11efd8df1bb6c5.tar.lz tangerine-wallet-browser-9e0c0745ab0f2aa207b0c062ad11efd8df1bb6c5.tar.xz tangerine-wallet-browser-9e0c0745ab0f2aa207b0c062ad11efd8df1bb6c5.tar.zst tangerine-wallet-browser-9e0c0745ab0f2aa207b0c062ad11efd8df1bb6c5.zip |
linting && format fixing
Diffstat (limited to 'app/scripts/lib/pending-tx-tracker.js')
-rw-r--r-- | app/scripts/lib/pending-tx-tracker.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/app/scripts/lib/pending-tx-tracker.js b/app/scripts/lib/pending-tx-tracker.js index b90851b58..cbc3f47e6 100644 --- a/app/scripts/lib/pending-tx-tracker.js +++ b/app/scripts/lib/pending-tx-tracker.js @@ -1,7 +1,6 @@ const EventEmitter = require('events') const EthQuery = require('ethjs-query') const sufficientBalance = require('./util').sufficientBalance -const RETRY_LIMIT = 3500 // Retry 3500 blocks, or about 1 day. /* Utility class for tracking the transactions as they @@ -25,11 +24,10 @@ module.exports = class PendingTransactionTracker extends EventEmitter { super() this.query = new EthQuery(config.provider) this.nonceTracker = config.nonceTracker - + this.retryLimit = config.retryLimit || Infinity this.getBalance = config.getBalance this.getPendingTransactions = config.getPendingTransactions this.publishTransaction = config.publishTransaction - this.giveUpOnTransaction = config.giveUpOnTransaction } // checks if a signed tx is in a block and @@ -102,8 +100,9 @@ module.exports = class PendingTransactionTracker extends EventEmitter { if (balance === undefined) return if (!('retryCount' in txMeta)) txMeta.retryCount = 0 - if (txMeta.retryCount > RETRY_LIMIT) { - return this.giveUpOnTransaction(txMeta.id) + if (txMeta.retryCount > this.retryLimit) { + const err = new Error(`Gave up submitting after ${this.retryLimit} blocks un-mined.`) + return this.emit('txFailed', txMeta.id, err) } // if the value of the transaction is greater then the balance, fail. |