diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-08-24 12:14:46 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-08-24 12:14:46 +0800 |
commit | 55c1a259b1ac01e8a8f6b241bac7a3b1cd16f3ec (patch) | |
tree | 62d76ff73e9d98ca1e42344b465fc0cbc867adc3 /app | |
parent | e057c37b337f34556af1734ceb44e7a4d9a7b08c (diff) | |
download | tangerine-wallet-browser-55c1a259b1ac01e8a8f6b241bac7a3b1cd16f3ec.tar tangerine-wallet-browser-55c1a259b1ac01e8a8f6b241bac7a3b1cd16f3ec.tar.gz tangerine-wallet-browser-55c1a259b1ac01e8a8f6b241bac7a3b1cd16f3ec.tar.bz2 tangerine-wallet-browser-55c1a259b1ac01e8a8f6b241bac7a3b1cd16f3ec.tar.lz tangerine-wallet-browser-55c1a259b1ac01e8a8f6b241bac7a3b1cd16f3ec.tar.xz tangerine-wallet-browser-55c1a259b1ac01e8a8f6b241bac7a3b1cd16f3ec.tar.zst tangerine-wallet-browser-55c1a259b1ac01e8a8f6b241bac7a3b1cd16f3ec.zip |
Fix network nonce parsing
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/lib/nonce-tracker.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/scripts/lib/nonce-tracker.js b/app/scripts/lib/nonce-tracker.js index 8c2568c3f..d49c7f205 100644 --- a/app/scripts/lib/nonce-tracker.js +++ b/app/scripts/lib/nonce-tracker.js @@ -37,8 +37,14 @@ class NonceTracker { const pendingTxs = this.getPendingTransactions(address) const localNonceResult = this._getHighestContinuousFrom(pendingTxs, highestSuggested) || 0 - nonceDetails.local = localNonceResult.details - nonceDetails.network = networkNonceResult.details + nonceDetails.params = { + highestLocalNonce, + highestSuggested, + nextNetworkNonce, + } + nonceDetails.local = localNonceResult + nonceDetails.network = networkNonceResult + const nextNonce = Math.max(networkNonceResult.nonce, localNonceResult.nonce) assert(Number.isInteger(nextNonce), `nonce-tracker - nextNonce is not an integer - got: (${typeof nextNonce}) "${nextNonce}"`) @@ -82,8 +88,9 @@ class NonceTracker { // and pending count are from the same block const currentBlock = await this._getCurrentBlock() const blockNumber = currentBlock.blockNumber - const baseCountHex = await this.ethQuery.getTransactionCount(address, blockNumber) - const baseCount = parseInt(baseCountHex, 16) + const baseCountBN = await this.ethQuery.getTransactionCount(address, blockNumber) + const baseString = baseCountBN.toString() + const baseCount = parseInt(baseString) assert(Number.isInteger(baseCount), `nonce-tracker - baseCount is not an integer - got: (${typeof baseCount}) "${baseCount}"`) const nonceDetails = { blockNumber, baseCount } return { name: 'network', nonce: baseCount, details: nonceDetails } |