aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-08-22 09:04:05 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-08-22 09:04:05 +0800
commit604c91f7b2158b09acfcf0e56ea77d0fad0d9dec (patch)
treed2b6a7f7bad152ce54881cac66a04163a65f0593 /app
parent38ba31bbe01785761c03f5d7d781939104d34f37 (diff)
downloadtangerine-wallet-browser-604c91f7b2158b09acfcf0e56ea77d0fad0d9dec.tar
tangerine-wallet-browser-604c91f7b2158b09acfcf0e56ea77d0fad0d9dec.tar.gz
tangerine-wallet-browser-604c91f7b2158b09acfcf0e56ea77d0fad0d9dec.tar.bz2
tangerine-wallet-browser-604c91f7b2158b09acfcf0e56ea77d0fad0d9dec.tar.lz
tangerine-wallet-browser-604c91f7b2158b09acfcf0e56ea77d0fad0d9dec.tar.xz
tangerine-wallet-browser-604c91f7b2158b09acfcf0e56ea77d0fad0d9dec.tar.zst
tangerine-wallet-browser-604c91f7b2158b09acfcf0e56ea77d0fad0d9dec.zip
nonce-tracker - pass tests
Diffstat (limited to 'app')
-rw-r--r--app/scripts/lib/nonce-tracker.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/app/scripts/lib/nonce-tracker.js b/app/scripts/lib/nonce-tracker.js
index c20459650..ee36e3d5d 100644
--- a/app/scripts/lib/nonce-tracker.js
+++ b/app/scripts/lib/nonce-tracker.js
@@ -30,9 +30,11 @@ class NonceTracker {
const nonceDetails = await this._getNetworkNonceAndDetails(address)
const networkNonce = nonceDetails.networkNonce
const nextNonce = Math.max(networkNonce, localNextNonce)
+ const currentPendingNonce = this._getLocalPendingNonce(address)
assert(Number.isInteger(nextNonce), `nonce-tracker - nextNonce is not an integer - got: (${typeof nextNonce}) "${nextNonce}"`)
// collect the numbers used to calculate the nonce for debugging
nonceDetails.localNextNonce = localNextNonce
+ nonceDetails.currentPendingNonce = currentPendingNonce
// return nonce and release cb
return { nextNonce, nonceDetails, releaseLock }
}
@@ -82,17 +84,14 @@ class NonceTracker {
// and pending count are from the same block
const currentBlock = await this._getCurrentBlock()
const blockNumber = currentBlock.blockNumber
- const pendingNonce = this._getLocalPendingNonce(address)
- const pendingCount = this._getPendingTransactionCount(address)
- assert(Number.isInteger(pendingCount), `nonce-tracker - pendingCount is not an integer - got: (${typeof pendingCount}) "${pendingCount}"`)
const baseCountHex = await this._getTxCount(address, currentBlock)
const baseCount = parseInt(baseCountHex, 16)
assert(Number.isInteger(baseCount), `nonce-tracker - baseCount is not an integer - got: (${typeof baseCount}) "${baseCount}"`)
// if the nonce provided by the network is higher then a pending tx
// toss out the pending txCount
- const networkNonce = pendingNonce > baseCount ? baseCount + pendingCount : baseCount
+ const networkNonce = baseCount
- return {networkNonce, blockNumber, baseCountHex, baseCount, pendingCount, pendingNonce}
+ return {networkNonce, blockNumber, baseCountHex, baseCount}
}
_getLocalNextNonce (address) {