diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-10-06 05:50:19 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-10-06 05:50:19 +0800 |
commit | cf178341c1944560fc9e092bc19fb3257200f9da (patch) | |
tree | 9c13530eac04032cf376e74efd4372363f4495b5 /app | |
parent | c821a6b93a5a8e0f564b69d493c350e3763e749b (diff) | |
parent | 833d73da566f5d5d379f594c309318bab6eadbfb (diff) | |
download | tangerine-wallet-browser-cf178341c1944560fc9e092bc19fb3257200f9da.tar tangerine-wallet-browser-cf178341c1944560fc9e092bc19fb3257200f9da.tar.gz tangerine-wallet-browser-cf178341c1944560fc9e092bc19fb3257200f9da.tar.bz2 tangerine-wallet-browser-cf178341c1944560fc9e092bc19fb3257200f9da.tar.lz tangerine-wallet-browser-cf178341c1944560fc9e092bc19fb3257200f9da.tar.xz tangerine-wallet-browser-cf178341c1944560fc9e092bc19fb3257200f9da.tar.zst tangerine-wallet-browser-cf178341c1944560fc9e092bc19fb3257200f9da.zip |
Merge branch 'master' into SignTypedData
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/controllers/transactions.js | 2 | ||||
-rw-r--r-- | app/scripts/lib/pending-tx-tracker.js | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js index 94e04c429..a0f983deb 100644 --- a/app/scripts/controllers/transactions.js +++ b/app/scripts/controllers/transactions.js @@ -59,7 +59,7 @@ module.exports = class TransactionController extends EventEmitter { this.pendingTxTracker = new PendingTransactionTracker({ provider: this.provider, nonceTracker: this.nonceTracker, - retryLimit: 3500, // Retry 3500 blocks, or about 1 day. + retryTimePeriod: 86400000, // Retry 3500 blocks, or about 1 day. publishTransaction: (rawTx) => this.query.sendRawTransaction(rawTx), getPendingTransactions: this.txStateManager.getPendingTransactions.bind(this.txStateManager), }) diff --git a/app/scripts/lib/pending-tx-tracker.js b/app/scripts/lib/pending-tx-tracker.js index 6f1601586..8a626e222 100644 --- a/app/scripts/lib/pending-tx-tracker.js +++ b/app/scripts/lib/pending-tx-tracker.js @@ -22,7 +22,8 @@ module.exports = class PendingTransactionTracker extends EventEmitter { super() this.query = new EthQuery(config.provider) this.nonceTracker = config.nonceTracker - this.retryLimit = config.retryLimit || Infinity + // default is one day + this.retryTimePeriod = config.retryTimePeriod || 86400000 this.getPendingTransactions = config.getPendingTransactions this.publishTransaction = config.publishTransaction } @@ -99,8 +100,9 @@ module.exports = class PendingTransactionTracker extends EventEmitter { } async _resubmitTx (txMeta) { - if (txMeta.retryCount > this.retryLimit) { - const err = new Error(`Gave up submitting after ${this.retryLimit} blocks un-mined.`) + if (Date.now() > txMeta.time + this.retryTimePeriod) { + const hours = (this.retryTimePeriod / 3.6e+6).toFixed(1) + const err = new Error(`Gave up submitting after ${hours} hours.`) return this.emit('tx:failed', txMeta.id, err) } |