@@ -23,7 +23,10 @@ module.exports = class TransactionController extends EventEmitter {
23
23
this . query = opts . ethQuery
24
24
this . txProviderUtils = new TxProviderUtil ( this . query )
25
25
this . blockTracker . on ( 'rawBlock' , this . checkForTxInBlock . bind ( this ) )
26
- this . blockTracker . on ( 'latest' , this . resubmitPendingTxs . bind ( this ) )
26
+ // this is a little messy but until ethstore has been either
27
+ // removed or redone this is to guard against the race condition
28
+ // where ethStore hasent been populated by the results yet
29
+ this . blockTracker . once ( 'latest' , ( ) => this . blockTracker . on ( 'latest' , this . resubmitPendingTxs . bind ( this ) ) )
27
30
this . blockTracker . on ( 'sync' , this . queryPendingTxs . bind ( this ) )
28
31
this . signEthTx = opts . signTransaction
29
32
this . nonceLock = Semaphore ( 1 )
@@ -414,10 +417,24 @@ module.exports = class TransactionController extends EventEmitter {
414
417
// only try resubmitting if their are transactions to resubmit
415
418
if ( ! pending . length ) return
416
419
const resubmit = denodeify ( this . _resubmitTx . bind ( this ) )
417
- Promise . all ( pending . map ( txMeta => resubmit ( txMeta ) ) )
420
+ pending . forEach ( ( txMeta ) => resubmit ( txMeta )
418
421
. catch ( ( reason ) => {
419
- log . info ( 'Problem resubmitting tx' , reason )
420
- } )
422
+ /*
423
+ Dont marked as failed if the error is a "known" transaction warning
424
+ "there is already a transaction with the same sender-nonce
425
+ but higher/same gas price"
426
+ */
427
+ const errorMessage = reason . message . toLowerCase ( )
428
+ const isKnownTx = (
429
+ // geth
430
+ errorMessage === 'replacement transaction underpriced'
431
+ || errorMessage . startsWith ( 'known transaction' )
432
+ // parity
433
+ || errorMessage === 'gas price too low to replace'
434
+ )
435
+ // ignore resubmit warnings, return early
436
+ if ( ! isKnownTx ) this . setTxStatusFailed ( txMeta . id , reason . message )
437
+ } ) )
421
438
}
422
439
423
440
_resubmitTx ( txMeta , cb ) {
0 commit comments