When network nonce is highest, it should be used.

This commit is contained in:
Dan Finlay 2017-08-21 11:59:51 -07:00
parent 0f36e0e6da
commit bb24f07b17
1 changed files with 15 additions and 4 deletions

View File

@ -15,7 +15,6 @@ describe('Nonce Tracker', function () {
const txGen = new MockTxGen()
confirmedTxs = txGen.generate({ status: 'confirmed' }, { count: 3 })
pendingTxs = txGen.generate({ status: 'pending' }, { count: 1 })
console.dir(txGen.txs)
nonceTracker = generateNonceTrackerWith(pendingTxs, confirmedTxs, '0x1')
})
@ -62,7 +61,6 @@ describe('Nonce Tracker', function () {
it('should return nonce after those', async function () {
this.timeout(15000)
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
console.dir(nonceLock.nextNonce)
assert.equal(nonceLock.nextNonce, '2', 'nonce should be 2')
await nonceLock.releaseLock()
})
@ -78,7 +76,6 @@ describe('Nonce Tracker', function () {
it('should return nonce after those', async function () {
this.timeout(15000)
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
console.dir(nonceLock.nextNonce)
assert.equal(nonceLock.nextNonce, '2', 'nonce should be 2')
await nonceLock.releaseLock()
})
@ -94,11 +91,25 @@ describe('Nonce Tracker', function () {
it('should return nonce after those', async function () {
this.timeout(15000)
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
console.dir(nonceLock.nextNonce)
assert.equal(nonceLock.nextNonce, '2', 'nonce should be 2')
await nonceLock.releaseLock()
})
})
describe('when provider nonce is higher than other metrics', function () {
beforeEach(function () {
const txGen = new MockTxGen()
pendingTxs = txGen.generate({ status: 'pending' }, { count: 2 })
nonceTracker = generateNonceTrackerWith(pendingTxs, [], '0x05')
})
it('should return nonce after those', async function () {
this.timeout(15000)
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
assert.equal(nonceLock.nextNonce, '6', 'nonce should be 6')
await nonceLock.releaseLock()
})
})
})
})