@@ -4,8 +4,8 @@ const Mutex = require('await-semaphore').Mutex
44
55class NonceTracker {
66
7- constructor ( { blockTracker , provider, getPendingTransactions } ) {
8- this . blockTracker = blockTracker
7+ constructor ( { provider, getPendingTransactions } ) {
8+ this . provider = provider
99 this . ethQuery = new EthQuery ( provider )
1010 this . getPendingTransactions = getPendingTransactions
1111 this . lockMap = { }
@@ -39,16 +39,17 @@ class NonceTracker {
3939 assert ( Number . isInteger ( nextNonce ) , `nonce-tracker - nextNonce is not an integer - got: (${ typeof nextNonce } ) "${ nextNonce } "` )
4040 // collect the numbers used to calculate the nonce for debugging
4141 const blockNumber = currentBlock . number
42- const nonceDetails = { blockNumber, baseCount, pendingCount }
42+ const nonceDetails = { blockNumber, baseCount, baseCountHex , pendingCount }
4343 // return nonce and release cb
4444 return { nextNonce, nonceDetails, releaseLock }
4545 }
4646
4747 async _getCurrentBlock ( ) {
48- const currentBlock = this . blockTracker . getCurrentBlock ( )
48+ const blockTracker = this . _getBlockTracker ( )
49+ const currentBlock = blockTracker . getCurrentBlock ( )
4950 if ( currentBlock ) return currentBlock
5051 return await Promise ( ( reject , resolve ) => {
51- this . blockTracker . once ( 'latest' , resolve )
52+ blockTracker . once ( 'latest' , resolve )
5253 } )
5354 }
5455
@@ -82,6 +83,12 @@ class NonceTracker {
8283 return mutex
8384 }
8485
86+ // this is a hotfix for the fact that the blockTracker will
87+ // change when the network changes
88+ _getBlockTracker ( ) {
89+ return this . provider . _blockTracker
90+ }
91+
8592}
8693
8794module . exports = NonceTracker
0 commit comments