aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-08-23 06:34:30 +0800
committerkumavis <aaron@kumavis.me>2017-08-23 06:34:30 +0800
commit247965ebbe99bd611aaa6b7a5c6e86f33dcdea1d (patch)
tree91b80007d76fcebf60c487c5d2e4cdda0671f999 /app/scripts
parent0a93b65a3dea32a85a73674fb40ee40257ed18d7 (diff)
downloadtangerine-wallet-browser-247965ebbe99bd611aaa6b7a5c6e86f33dcdea1d.tar
tangerine-wallet-browser-247965ebbe99bd611aaa6b7a5c6e86f33dcdea1d.tar.gz
tangerine-wallet-browser-247965ebbe99bd611aaa6b7a5c6e86f33dcdea1d.tar.bz2
tangerine-wallet-browser-247965ebbe99bd611aaa6b7a5c6e86f33dcdea1d.tar.lz
tangerine-wallet-browser-247965ebbe99bd611aaa6b7a5c6e86f33dcdea1d.tar.xz
tangerine-wallet-browser-247965ebbe99bd611aaa6b7a5c6e86f33dcdea1d.tar.zst
tangerine-wallet-browser-247965ebbe99bd611aaa6b7a5c6e86f33dcdea1d.zip
nonce-tracker - more debugging numbers for nonceDetails
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/lib/nonce-tracker.js18
1 files changed, 8 insertions, 10 deletions
diff --git a/app/scripts/lib/nonce-tracker.js b/app/scripts/lib/nonce-tracker.js
index 03bc3c278..30c59fa46 100644
--- a/app/scripts/lib/nonce-tracker.js
+++ b/app/scripts/lib/nonce-tracker.js
@@ -84,7 +84,13 @@ class NonceTracker {
async _getlocalNextNonce (address) {
let nextNonce
// check our local tx history for the highest nonce (if any)
- const highestNonce = this._getLocalHighestNonce(address)
+ const confirmedTransactions = this.getConfirmedTransactions(address)
+ const pendingTransactions = this.getPendingTransactions(address)
+ const transactions = confirmedTransactions.concat(pendingTransactions)
+ const highestConfirmedNonce = this._getHighestNonce(confirmedTransactions)
+ const highestPendingNonce = this._getHighestNonce(pendingTransactions)
+ const highestNonce = this._getHighestNonce(transactions)
+
const haveHighestNonce = Number.isInteger(highestNonce)
if (haveHighestNonce) {
// next nonce is the nonce after our last
@@ -93,18 +99,10 @@ class NonceTracker {
// no local tx history so next must be first (zero)
nextNonce = 0
}
- const nonceDetails = { highestNonce, haveHighestNonce }
+ const nonceDetails = { highestNonce, haveHighestNonce, highestConfirmedNonce, highestPendingNonce }
return { name: 'local', nonce: nextNonce, details: nonceDetails }
}
- _getLocalHighestNonce (address) {
- const confirmedTransactions = this.getConfirmedTransactions(address)
- const pendingTransactions = this.getPendingTransactions(address)
- const transactions = confirmedTransactions.concat(pendingTransactions)
- const highestNonce = this._getHighestNonce(transactions)
- return highestNonce
- }
-
_getPendingTransactionCount (address) {
const pendingTransactions = this.getPendingTransactions(address)
return this._reduceTxListToUniqueNonces(pendingTransactions).length