aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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