mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Rename variable to be more understandable
This commit is contained in:
parent
47039cc3a9
commit
f50a7a8fe8
@ -31,14 +31,13 @@ class NonceTracker {
|
|||||||
const networkNonceResult = await this._getNetworkNextNonce(address)
|
const networkNonceResult = await this._getNetworkNextNonce(address)
|
||||||
const highestLocallyConfirmed = this._getHighestLocallyConfirmed(address)
|
const highestLocallyConfirmed = this._getHighestLocallyConfirmed(address)
|
||||||
const nextNetworkNonce = networkNonceResult.nonce
|
const nextNetworkNonce = networkNonceResult.nonce
|
||||||
const highestLocalNonce = highestLocallyConfirmed
|
const highestSuggested = Math.max(nextNetworkNonce, highestLocallyConfirmed)
|
||||||
const highestSuggested = Math.max(nextNetworkNonce, highestLocalNonce)
|
|
||||||
|
|
||||||
const pendingTxs = this.getPendingTransactions(address)
|
const pendingTxs = this.getPendingTransactions(address)
|
||||||
const localNonceResult = this._getHighestContinuousFrom(pendingTxs, highestSuggested) || 0
|
const localNonceResult = this._getHighestContinuousFrom(pendingTxs, highestSuggested) || 0
|
||||||
|
|
||||||
nonceDetails.params = {
|
nonceDetails.params = {
|
||||||
highestLocalNonce,
|
highestLocallyConfirmed,
|
||||||
highestSuggested,
|
highestSuggested,
|
||||||
nextNetworkNonce,
|
nextNetworkNonce,
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,25 @@ describe('Nonce Tracker', function () {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe.only('issue 3670', function () {
|
describe('sentry issue 476304902', function () {
|
||||||
|
beforeEach(function () {
|
||||||
|
const txGen = new MockTxGen()
|
||||||
|
pendingTxs = txGen.generate({ status: 'submitted' }, {
|
||||||
|
fromNonce: 3,
|
||||||
|
count: 29,
|
||||||
|
})
|
||||||
|
nonceTracker = generateNonceTrackerWith(pendingTxs, [], '0x3')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should return 9', async function () {
|
||||||
|
this.timeout(15000)
|
||||||
|
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
|
||||||
|
assert.equal(nonceLock.nextNonce, '32', `nonce should be 32 got ${nonceLock.nextNonce}`)
|
||||||
|
await nonceLock.releaseLock()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('issue 3670', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
const txGen = new MockTxGen()
|
const txGen = new MockTxGen()
|
||||||
pendingTxs = txGen.generate({ status: 'submitted' }, {
|
pendingTxs = txGen.generate({ status: 'submitted' }, {
|
||||||
@ -46,7 +64,6 @@ describe('Nonce Tracker', function () {
|
|||||||
it('should return 9', async function () {
|
it('should return 9', async function () {
|
||||||
this.timeout(15000)
|
this.timeout(15000)
|
||||||
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
|
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
|
||||||
console.log(JSON.stringify(nonceLock, null, 2))
|
|
||||||
assert.equal(nonceLock.nextNonce, '9', `nonce should be 9 got ${nonceLock.nextNonce}`)
|
assert.equal(nonceLock.nextNonce, '9', `nonce should be 9 got ${nonceLock.nextNonce}`)
|
||||||
await nonceLock.releaseLock()
|
await nonceLock.releaseLock()
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user