aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-10-12 09:33:02 +0800
committerkumavis <aaron@kumavis.me>2017-10-12 09:33:36 +0800
commitdcf10f3d7559b428cc189fb4406580d816eae365 (patch)
treedb513e8612923fc1133dc2eb541726531a9320a8 /app
parentf0713d4b1a28d608ddca6e251e947d1b2e14b6d3 (diff)
downloadtangerine-wallet-browser-dcf10f3d7559b428cc189fb4406580d816eae365.tar
tangerine-wallet-browser-dcf10f3d7559b428cc189fb4406580d816eae365.tar.gz
tangerine-wallet-browser-dcf10f3d7559b428cc189fb4406580d816eae365.tar.bz2
tangerine-wallet-browser-dcf10f3d7559b428cc189fb4406580d816eae365.tar.lz
tangerine-wallet-browser-dcf10f3d7559b428cc189fb4406580d816eae365.tar.xz
tangerine-wallet-browser-dcf10f3d7559b428cc189fb4406580d816eae365.tar.zst
tangerine-wallet-browser-dcf10f3d7559b428cc189fb4406580d816eae365.zip
nonce-tracker - use blockTracker directly
Diffstat (limited to 'app')
-rw-r--r--app/scripts/controllers/transactions.js1
-rw-r--r--app/scripts/lib/nonce-tracker.js10
2 files changed, 4 insertions, 7 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js
index ef659a300..d46dee230 100644
--- a/app/scripts/controllers/transactions.js
+++ b/app/scripts/controllers/transactions.js
@@ -46,6 +46,7 @@ module.exports = class TransactionController extends EventEmitter {
this.txStateManager.on('tx:status-update', this.emit.bind(this, 'tx:status-update'))
this.nonceTracker = new NonceTracker({
provider: this.provider,
+ blockTracker: this.blockTracker,
getPendingTransactions: this.txStateManager.getPendingTransactions.bind(this.txStateManager),
getConfirmedTransactions: (address) => {
return this.txStateManager.getFilteredTxList({
diff --git a/app/scripts/lib/nonce-tracker.js b/app/scripts/lib/nonce-tracker.js
index 0029ac953..2af40a27f 100644
--- a/app/scripts/lib/nonce-tracker.js
+++ b/app/scripts/lib/nonce-tracker.js
@@ -4,8 +4,9 @@ const Mutex = require('await-semaphore').Mutex
class NonceTracker {
- constructor ({ provider, getPendingTransactions, getConfirmedTransactions }) {
+ constructor ({ provider, blockTracker, getPendingTransactions, getConfirmedTransactions }) {
this.provider = provider
+ this.blockTracker = blockTracker
this.ethQuery = new EthQuery(provider)
this.getPendingTransactions = getPendingTransactions
this.getConfirmedTransactions = getConfirmedTransactions
@@ -53,7 +54,7 @@ class NonceTracker {
}
async _getCurrentBlock () {
- const blockTracker = this._getBlockTracker()
+ const blockTracker = this.blockTracker
const currentBlock = blockTracker.getCurrentBlock()
if (currentBlock) return currentBlock
return await Promise((reject, resolve) => {
@@ -139,11 +140,6 @@ class NonceTracker {
return { name: 'local', nonce: highest, details: { startPoint, highest } }
}
- // this is a hotfix for the fact that the blockTracker will
- // change when the network changes
- _getBlockTracker () {
- return this.provider._blockTracker
- }
}
module.exports = NonceTracker