aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions/tx-state-manager.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-05-30 07:12:36 +0800
committerkumavis <aaron@kumavis.me>2018-05-30 07:12:36 +0800
commit4205d9272991c6523fbb8b9222f86411d0253325 (patch)
tree2dce14c72c4a0a62d57f8889072233e2a1f1f410 /app/scripts/controllers/transactions/tx-state-manager.js
parent219cb83d94566a597f7ffa2ba34454460d2deb5d (diff)
parent5fc24930a7febd919ec6a8f6e9c14f2bac0ef2b2 (diff)
downloadtangerine-wallet-browser-4205d9272991c6523fbb8b9222f86411d0253325.tar.gz
tangerine-wallet-browser-4205d9272991c6523fbb8b9222f86411d0253325.tar.zst
tangerine-wallet-browser-4205d9272991c6523fbb8b9222f86411d0253325.zip
Merge branch 'master' of github.com:MetaMask/metamask-extension into merge-master
Diffstat (limited to 'app/scripts/controllers/transactions/tx-state-manager.js')
-rw-r--r--app/scripts/controllers/transactions/tx-state-manager.js21
1 files changed, 14 insertions, 7 deletions
diff --git a/app/scripts/controllers/transactions/tx-state-manager.js b/app/scripts/controllers/transactions/tx-state-manager.js
index 00e837571..0aae4774b 100644
--- a/app/scripts/controllers/transactions/tx-state-manager.js
+++ b/app/scripts/controllers/transactions/tx-state-manager.js
@@ -2,6 +2,7 @@ const extend = require('xtend')
const EventEmitter = require('events')
const ObservableStore = require('obs-store')
const ethUtil = require('ethereumjs-util')
+const log = require('loglevel')
const txStateHistoryHelper = require('./lib/tx-state-history-helper')
const createId = require('../../lib/random-id')
const { getFinalStates } = require('./lib/util')
@@ -398,13 +399,19 @@ class TransactionStateManager extends EventEmitter {
_setTxStatus (txId, status) {
const txMeta = this.getTx(txId)
txMeta.status = status
- this.emit(`${txMeta.id}:${status}`, txId)
- this.emit(`tx:status-update`, txId, status)
- if (['submitted', 'rejected', 'failed'].includes(status)) {
- this.emit(`${txMeta.id}:finished`, txMeta)
- }
- this.updateTx(txMeta, `txStateManager: setting status to ${status}`)
- this.emit('update:badge')
+ setTimeout(() => {
+ try {
+ this.updateTx(txMeta, `txStateManager: setting status to ${status}`)
+ this.emit(`${txMeta.id}:${status}`, txId)
+ this.emit(`tx:status-update`, txId, status)
+ if (['submitted', 'rejected', 'failed'].includes(status)) {
+ this.emit(`${txMeta.id}:finished`, txMeta)
+ }
+ this.emit('update:badge')
+ } catch (error) {
+ log.error(error)
+ }
+ })
}
/**