aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-05-29 15:41:28 +0800
committerkumavis <aaron@kumavis.me>2018-05-29 15:41:28 +0800
commit16d0db15e05ec97adfcb050901d84a5130e88892 (patch)
treee2921f7717b0a5db780f8258d0e7f3318631f5ac /app/scripts/controllers
parent7d449e974ddd5412581fe00976429c2ebb9ab644 (diff)
downloadtangerine-wallet-browser-16d0db15e05ec97adfcb050901d84a5130e88892.tar.gz
tangerine-wallet-browser-16d0db15e05ec97adfcb050901d84a5130e88892.tar.zst
tangerine-wallet-browser-16d0db15e05ec97adfcb050901d84a5130e88892.zip
controllers - transactions - fix tx confirmation
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r--app/scripts/controllers/transactions/index.js2
-rw-r--r--app/scripts/controllers/transactions/pending-tx-tracker.js4
2 files changed, 3 insertions, 3 deletions
diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js
index f84fd95ff..6266fea16 100644
--- a/app/scripts/controllers/transactions/index.js
+++ b/app/scripts/controllers/transactions/index.js
@@ -57,7 +57,6 @@ class TransactionController extends EventEmitter {
initState: opts.initState,
txHistoryLimit: opts.txHistoryLimit,
getNetwork: this.getNetwork.bind(this),
- confirmTransaction: this.confirmTransaction.bind(this),
})
this._onBootCleanUp()
@@ -389,6 +388,7 @@ class TransactionController extends EventEmitter {
this.txStateManager.updateTx(txMeta, 'transactions/pending-tx-tracker#event: tx:warning')
})
this.pendingTxTracker.on('tx:failed', this.txStateManager.setTxStatusFailed.bind(this.txStateManager))
+ this.pendingTxTracker.on('tx:confirmed', (txId) => this.confirmTransaction(txId))
this.pendingTxTracker.on('tx:block-update', (txMeta, latestBlockNumber) => {
if (!txMeta.firstRetryBlockNumber) {
txMeta.firstRetryBlockNumber = latestBlockNumber
diff --git a/app/scripts/controllers/transactions/pending-tx-tracker.js b/app/scripts/controllers/transactions/pending-tx-tracker.js
index 68f016d79..9a764b962 100644
--- a/app/scripts/controllers/transactions/pending-tx-tracker.js
+++ b/app/scripts/controllers/transactions/pending-tx-tracker.js
@@ -28,7 +28,6 @@ class PendingTransactionTracker extends EventEmitter {
this.getCompletedTransactions = config.getCompletedTransactions
this.publishTransaction = config.publishTransaction
this.confirmTransaction = config.confirmTransaction
- this.updatePendingTxs()
}
/**
@@ -37,6 +36,7 @@ class PendingTransactionTracker extends EventEmitter {
async updatePendingTxs () {
const pendingTxs = this.getPendingTransactions()
// in order to keep the nonceTracker accurate we block it while updating pending transactions
+ console.log('updating pending txs....', pendingTxs)
const nonceGlobalLock = await this.nonceTracker.getGlobalLock()
try {
await Promise.all(pendingTxs.map((txMeta) => this._checkPendingTx(txMeta)))
@@ -152,7 +152,7 @@ class PendingTransactionTracker extends EventEmitter {
const txParams = await this.query.getTransactionByHash(txHash)
if (!txParams) return
if (txParams.blockNumber) {
- this.confirmTransaction(txId)
+ this.emit('tx:confirmed', txId)
}
} catch (err) {
txMeta.warning = {