@@ -417,25 +417,29 @@ class ServiceHistory extends ServiceBase {
417417 // Find transactions confirmed through history details query but not in on-chain history, these need to be saved
418418 let confirmedTxsToSave : IAccountHistoryTx [ ] = [ ] ;
419419
420- confirmedTxsToSave = confirmedTxs . map ( ( tx ) => {
421- const onChainHistoryTx = onChainHistoryTxs . find (
422- ( item ) => item . id === tx . id ,
423- ) ;
424- if ( onChainHistoryTx ) {
425- return onChainHistoryTx ;
426- }
427- return tx ;
428- } ) ;
420+ confirmedTxsToSave = confirmedTxs
421+ . map ( ( tx ) => {
422+ const onChainHistoryTx = onChainHistoryTxs . find (
423+ ( item ) => item . id === tx . id ,
424+ ) ;
425+ if ( onChainHistoryTx ) {
426+ return onChainHistoryTx ;
427+ }
428+ return tx ;
429+ } )
430+ . filter ( ( tx ) => tx . decodedTx . status !== EDecodedTxStatus . Pending ) ;
431+
432+ const finalConfirmedTxs = unionBy (
433+ [ ...confirmedTxsToSave , ...onChainHistoryTxs ] ,
434+ ( tx ) => tx . id ,
435+ ) . filter ( ( tx ) => tx . decodedTx . status !== EDecodedTxStatus . Pending ) ;
429436
430437 await this . backgroundApi . simpleDb . localHistory . updateLocalHistoryConfirmedTxs (
431438 {
432439 networkId,
433440 accountAddress,
434441 xpub,
435- confirmedTxsToSave : unionBy (
436- [ ...confirmedTxsToSave , ...onChainHistoryTxs ] ,
437- ( tx ) => tx . id ,
438- ) ,
442+ confirmedTxsToSave : finalConfirmedTxs ,
439443 } ,
440444 ) ;
441445
0 commit comments