aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions/index.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-05-29 15:53:44 +0800
committerkumavis <aaron@kumavis.me>2018-05-29 15:53:44 +0800
commit58de5671cc26a8848b9e0e02bcd6d18bdfcd3ea8 (patch)
tree47fd188b7d8db48cb6dc5dd6ff0515c89a689a41 /app/scripts/controllers/transactions/index.js
parent16d0db15e05ec97adfcb050901d84a5130e88892 (diff)
downloadtangerine-wallet-browser-58de5671cc26a8848b9e0e02bcd6d18bdfcd3ea8.tar
tangerine-wallet-browser-58de5671cc26a8848b9e0e02bcd6d18bdfcd3ea8.tar.gz
tangerine-wallet-browser-58de5671cc26a8848b9e0e02bcd6d18bdfcd3ea8.tar.bz2
tangerine-wallet-browser-58de5671cc26a8848b9e0e02bcd6d18bdfcd3ea8.tar.lz
tangerine-wallet-browser-58de5671cc26a8848b9e0e02bcd6d18bdfcd3ea8.tar.xz
tangerine-wallet-browser-58de5671cc26a8848b9e0e02bcd6d18bdfcd3ea8.tar.zst
tangerine-wallet-browser-58de5671cc26a8848b9e0e02bcd6d18bdfcd3ea8.zip
controllers - transactions - fix tx status update on boot
Diffstat (limited to 'app/scripts/controllers/transactions/index.js')
-rw-r--r--app/scripts/controllers/transactions/index.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js
index 6266fea16..71e7ea920 100644
--- a/app/scripts/controllers/transactions/index.js
+++ b/app/scripts/controllers/transactions/index.js
@@ -83,7 +83,11 @@ class TransactionController extends EventEmitter {
this.txStateManager.store.subscribe(() => this._updateMemstore())
this.networkStore.subscribe(() => this._updateMemstore())
this.preferencesStore.subscribe(() => this._updateMemstore())
+
+ // request state update to finalize initialization
+ this._updatePendingTxsAfterFirstBlock()
}
+
/** @returns {number} the chainId*/
getChainId () {
const networkState = this.networkStore.getState()
@@ -349,6 +353,14 @@ class TransactionController extends EventEmitter {
this.getFilteredTxList = (opts) => this.txStateManager.getFilteredTxList(opts)
}
+ // called once on startup
+ async _updatePendingTxsAfterFirstBlock () {
+ // wait for first block so we know we're ready
+ await this.blockTracker.getLatestBlock()
+ // get status update for all pending transactions (for the current network)
+ await this.pendingTxTracker.updatePendingTxs()
+ }
+
/**
If transaction controller was rebooted with transactions that are uncompleted
in steps of the transaction signing or user confirmation process it will either