diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-06-16 04:44:58 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-06-16 04:44:58 +0800 |
commit | 39c7ed230d61b04d147e45a55ac7af0576961968 (patch) | |
tree | 7004351239ad6c73c1a6d177cbf90dfb7893643f /app | |
parent | a80945e73075b8c0dc43a68ba73da65d7074e098 (diff) | |
parent | 1a4f982739a09a4fd757b5f45fcaeef1a93dd4a3 (diff) | |
download | tangerine-wallet-browser-39c7ed230d61b04d147e45a55ac7af0576961968.tar tangerine-wallet-browser-39c7ed230d61b04d147e45a55ac7af0576961968.tar.gz tangerine-wallet-browser-39c7ed230d61b04d147e45a55ac7af0576961968.tar.bz2 tangerine-wallet-browser-39c7ed230d61b04d147e45a55ac7af0576961968.tar.lz tangerine-wallet-browser-39c7ed230d61b04d147e45a55ac7af0576961968.tar.xz tangerine-wallet-browser-39c7ed230d61b04d147e45a55ac7af0576961968.tar.zst tangerine-wallet-browser-39c7ed230d61b04d147e45a55ac7af0576961968.zip |
Merge remote-tracking branch 'origin/master' into AddTokenList
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/controllers/transactions.js | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js index d546615ed..07fe2bb26 100644 --- a/app/scripts/controllers/transactions.js +++ b/app/scripts/controllers/transactions.js @@ -9,7 +9,6 @@ const createId = require('../lib/random-id') const denodeify = require('denodeify') const RETRY_LIMIT = 200 -const RESUBMIT_INTERVAL = 10000 // Ten seconds module.exports = class TransactionController extends EventEmitter { constructor (opts) { @@ -26,6 +25,7 @@ module.exports = class TransactionController extends EventEmitter { this.query = opts.ethQuery this.txProviderUtils = new TxProviderUtil(this.query) this.blockTracker.on('block', this.checkForTxInBlock.bind(this)) + this.blockTracker.on('block', this.resubmitPendingTxs.bind(this)) this.signEthTx = opts.signTransaction this.nonceLock = Semaphore(1) @@ -34,8 +34,6 @@ module.exports = class TransactionController extends EventEmitter { this.store.subscribe(() => this._updateMemstore()) this.networkStore.subscribe(() => this._updateMemstore()) this.preferencesStore.subscribe(() => this._updateMemstore()) - - this.continuallyResubmitPendingTxs() } getState () { @@ -212,7 +210,7 @@ module.exports = class TransactionController extends EventEmitter { getChainId () { const networkState = this.networkStore.getState() - const getChainId = parseInt(networkState.network) + const getChainId = parseInt(networkState) if (Number.isNaN(getChainId)) { return 0 } else { @@ -409,18 +407,15 @@ module.exports = class TransactionController extends EventEmitter { this.memStore.updateState({ unapprovedTxs, selectedAddressTxList }) } - continuallyResubmitPendingTxs () { + resubmitPendingTxs () { const pending = this.getTxsByMetaData('status', 'submitted') + // only try resubmitting if their are transactions to resubmit + if (!pending.length) return const resubmit = denodeify(this.resubmitTx.bind(this)) Promise.all(pending.map(txMeta => resubmit(txMeta))) .catch((reason) => { log.info('Problem resubmitting tx', reason) }) - .then(() => { - global.setTimeout(() => { - this.continuallyResubmitPendingTxs() - }, RESUBMIT_INTERVAL) - }) } resubmitTx (txMeta, cb) { |