diff options
author | Frankie <frankie.diamond@gmail.com> | 2018-03-29 05:38:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-29 05:38:40 +0800 |
commit | 650b716f55fcfa809b22708b9ad43c8a0716f9fc (patch) | |
tree | 8ee75c387fab20a6e60b14b078768d486eaf4d3a /test | |
parent | 8766420f19251b95211dd99ff9a45e60cf0177ad (diff) | |
parent | f50a7a8fe891a803e50cc256200e8ce8c903ea2e (diff) | |
download | tangerine-wallet-browser-650b716f55fcfa809b22708b9ad43c8a0716f9fc.tar tangerine-wallet-browser-650b716f55fcfa809b22708b9ad43c8a0716f9fc.tar.gz tangerine-wallet-browser-650b716f55fcfa809b22708b9ad43c8a0716f9fc.tar.bz2 tangerine-wallet-browser-650b716f55fcfa809b22708b9ad43c8a0716f9fc.tar.lz tangerine-wallet-browser-650b716f55fcfa809b22708b9ad43c8a0716f9fc.tar.xz tangerine-wallet-browser-650b716f55fcfa809b22708b9ad43c8a0716f9fc.tar.zst tangerine-wallet-browser-650b716f55fcfa809b22708b9ad43c8a0716f9fc.zip |
Merge pull request #3782 from MetaMask/i3670-FixNonceBug
Add test for suspected nonce bug
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/nonce-tracker-test.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/unit/nonce-tracker-test.js b/test/unit/nonce-tracker-test.js index 8970cf84d..5a27882ef 100644 --- a/test/unit/nonce-tracker-test.js +++ b/test/unit/nonce-tracker-test.js @@ -33,6 +33,42 @@ describe('Nonce Tracker', 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 () { + const txGen = new MockTxGen() + pendingTxs = txGen.generate({ status: 'submitted' }, { + fromNonce: 6, + count: 3, + }) + nonceTracker = generateNonceTrackerWith(pendingTxs, [], '0x6') + }) + + it('should return 9', async function () { + this.timeout(15000) + const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926') + assert.equal(nonceLock.nextNonce, '9', `nonce should be 9 got ${nonceLock.nextNonce}`) + await nonceLock.releaseLock() + }) + }) + describe('with no previous txs', function () { beforeEach(function () { nonceTracker = generateNonceTrackerWith([], []) |