diff --git a/src/new_index/mempool.rs b/src/new_index/mempool.rs index 3b71db603..491404b9e 100644 --- a/src/new_index/mempool.rs +++ b/src/new_index/mempool.rs @@ -510,6 +510,10 @@ impl Mempool { .chain_err(|| "failed to update mempool from daemon")?; let to_remove: HashSet<&Txid> = old_txids.difference(&new_txids).collect(); + // 2. Remove missing transactions. Even if we are unable to download new transactions from + // the daemon, we still want to remove the transactions that are no longer in the mempool. + mempool.write().unwrap().remove(to_remove); + // 2. Download the new transactions from the daemon's mempool let to_add = Mempool::download_new_mempool_txs(&daemon, &old_txids, &new_txids)?; @@ -518,8 +522,6 @@ impl Mempool { let mut mempool = mempool.write().unwrap(); // Add new transactions mempool.add(to_add); - // Remove missing transactions - mempool.remove(to_remove); mempool.count .with_label_values(&["txs"])