File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -499,19 +499,21 @@ impl Mempool {
499
499
. chain_err ( || "failed to update mempool from daemon" ) ?;
500
500
let txids_to_remove: HashSet < & Txid > = old_txids. difference ( & all_txids) . collect ( ) ;
501
501
502
- // 2. Download the new transactions from the daemon's mempool
502
+ // 2. Remove missing transactions. Even if we are unable to download new transactions from
503
+ // the daemon, we still want to remove the transactions that are no longer in the mempool.
504
+ mempool. write ( ) . unwrap ( ) . remove ( txids_to_remove) ;
505
+
506
+ // 3. Download the new transactions from the daemon's mempool
503
507
let new_txids: Vec < & Txid > = all_txids. difference ( & old_txids) . collect ( ) ;
504
508
let txs_to_add = daemon
505
509
. gettransactions ( & new_txids)
506
510
. chain_err ( || format ! ( "failed to get {} transactions" , new_txids. len( ) ) ) ?;
507
511
508
- // 3 . Update local mempool to match daemon's state
512
+ // 4 . Update local mempool to match daemon's state
509
513
{
510
514
let mut mempool = mempool. write ( ) . unwrap ( ) ;
511
515
// Add new transactions
512
516
mempool. add ( txs_to_add) ;
513
- // Remove missing transactions
514
- mempool. remove ( txids_to_remove) ;
515
517
516
518
mempool
517
519
. count
You can’t perform that action at this time.
0 commit comments