@@ -417,23 +417,28 @@ module.exports = class TransactionController extends EventEmitter {
417
417
// only try resubmitting if their are transactions to resubmit
418
418
if ( ! pending . length ) return
419
419
const resubmit = denodeify ( this . _resubmitTx . bind ( this ) )
420
- pending . forEach ( ( txMeta ) => resubmit ( txMeta )
421
- . catch ( ( reason ) => {
420
+ pending . forEach ( ( txMeta ) => resubmit ( txMeta ) . catch ( ( err ) => {
422
421
/*
423
422
Dont marked as failed if the error is a "known" transaction warning
424
423
"there is already a transaction with the same sender-nonce
425
424
but higher/same gas price"
426
425
*/
427
- const errorMessage = reason . message . toLowerCase ( )
426
+ const errorMessage = err . message . toLowerCase ( )
428
427
const isKnownTx = (
429
428
// geth
430
429
errorMessage === 'replacement transaction underpriced'
431
430
|| errorMessage . startsWith ( 'known transaction' )
432
431
// parity
433
432
|| errorMessage === 'gas price too low to replace'
433
+ || errorMessage === 'transaction with the same hash was already imported.'
434
434
)
435
435
// ignore resubmit warnings, return early
436
- if ( ! isKnownTx ) this . setTxStatusFailed ( txMeta . id , reason . message )
436
+ if ( isKnownTx ) return
437
+ // encountered real error - transition to error state
438
+ this . setTxStatusFailed ( txMeta . id , {
439
+ errCode : err . errCode || err ,
440
+ message : err . message ,
441
+ } )
437
442
} ) )
438
443
}
439
444
@@ -448,15 +453,15 @@ module.exports = class TransactionController extends EventEmitter {
448
453
// if the value of the transaction is greater then the balance, fail.
449
454
if ( gtBalance ) {
450
455
const message = 'Insufficient balance.'
451
- this . setTxStatusFailed ( txMeta . id , message )
456
+ this . setTxStatusFailed ( txMeta . id , { message } )
452
457
cb ( )
453
458
return log . error ( message )
454
459
}
455
460
456
461
// if the nonce of the transaction is lower then the accounts nonce, fail.
457
462
if ( txNonce < nonce ) {
458
463
const message = 'Invalid nonce.'
459
- this . setTxStatusFailed ( txMeta . id , message )
464
+ this . setTxStatusFailed ( txMeta . id , { message } )
460
465
cb ( )
461
466
return log . error ( message )
462
467
}
0 commit comments