aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-07-27 02:37:00 +0800
committerkumavis <aaron@kumavis.me>2017-07-27 02:37:00 +0800
commit35a128db1e6ecba9076ec145c9d2334f623703b7 (patch)
treea2b178facff473e14b1a83f80aa3126408f3a783 /app
parentb15a2baaf3cf7b4850c427857e935b238d1e5cc2 (diff)
downloadtangerine-wallet-browser-35a128db1e6ecba9076ec145c9d2334f623703b7.tar
tangerine-wallet-browser-35a128db1e6ecba9076ec145c9d2334f623703b7.tar.gz
tangerine-wallet-browser-35a128db1e6ecba9076ec145c9d2334f623703b7.tar.bz2
tangerine-wallet-browser-35a128db1e6ecba9076ec145c9d2334f623703b7.tar.lz
tangerine-wallet-browser-35a128db1e6ecba9076ec145c9d2334f623703b7.tar.xz
tangerine-wallet-browser-35a128db1e6ecba9076ec145c9d2334f623703b7.tar.zst
tangerine-wallet-browser-35a128db1e6ecba9076ec145c9d2334f623703b7.zip
nonce-tracker - hotfix for provider proxying
Diffstat (limited to 'app')
-rw-r--r--app/scripts/controllers/transactions.js1
-rw-r--r--app/scripts/lib/nonce-tracker.js15
2 files changed, 11 insertions, 5 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js
index 8f53ffa8c..f71659042 100644
--- a/app/scripts/controllers/transactions.js
+++ b/app/scripts/controllers/transactions.js
@@ -24,7 +24,6 @@ module.exports = class TransactionController extends EventEmitter {
this.blockTracker = opts.blockTracker
this.nonceTracker = new NonceTracker({
provider: this.provider,
- blockTracker: this.provider._blockTracker,
getPendingTransactions: (address) => {
return this.getFilteredTxList({
from: address,
diff --git a/app/scripts/lib/nonce-tracker.js b/app/scripts/lib/nonce-tracker.js
index e33073ac1..8328e81ec 100644
--- a/app/scripts/lib/nonce-tracker.js
+++ b/app/scripts/lib/nonce-tracker.js
@@ -4,8 +4,8 @@ const Mutex = require('await-semaphore').Mutex
class NonceTracker {
- constructor ({ blockTracker, provider, getPendingTransactions }) {
- this.blockTracker = blockTracker
+ constructor ({ provider, getPendingTransactions }) {
+ this.provider = provider
this.ethQuery = new EthQuery(provider)
this.getPendingTransactions = getPendingTransactions
this.lockMap = {}
@@ -45,10 +45,11 @@ class NonceTracker {
}
async _getCurrentBlock () {
- const currentBlock = this.blockTracker.getCurrentBlock()
+ const blockTracker = this._getBlockTracker()
+ const currentBlock = blockTracker.getCurrentBlock()
if (currentBlock) return currentBlock
return await Promise((reject, resolve) => {
- this.blockTracker.once('latest', resolve)
+ blockTracker.once('latest', resolve)
})
}
@@ -82,6 +83,12 @@ class NonceTracker {
return mutex
}
+ // this is a hotfix for the fact that the blockTracker will
+ // change when the network changes
+ _getBlockTracker () {
+ return this.provider._blockTracker
+ }
+
}
module.exports = NonceTracker