aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/nonce-tracker.js
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/scripts/lib/nonce-tracker.js
parentb15a2baaf3cf7b4850c427857e935b238d1e5cc2 (diff)
downloadtangerine-wallet-browser-35a128db1e6ecba9076ec145c9d2334f623703b7.tar.gz
tangerine-wallet-browser-35a128db1e6ecba9076ec145c9d2334f623703b7.tar.zst
tangerine-wallet-browser-35a128db1e6ecba9076ec145c9d2334f623703b7.zip
nonce-tracker - hotfix for provider proxying
Diffstat (limited to 'app/scripts/lib/nonce-tracker.js')
-rw-r--r--app/scripts/lib/nonce-tracker.js15
1 files changed, 11 insertions, 4 deletions
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