1
0
Fork 0
mirror of https://github.com/romanz/electrs.git synced 2025-02-24 06:57:53 +01:00

[mempool] Fix bug on removing entries

Fixes issue where old mempool entires were only removed if new ones were
also added.
This commit is contained in:
Dagur Valberg Johannsson 2019-04-01 11:59:58 +02:00
parent 878f81cfeb
commit af227013f1

View file

@ -213,9 +213,7 @@ impl Tracker {
} }
}) })
.collect(); .collect();
if entries.is_empty() { if !entries.is_empty() {
return Ok(());
}
let txids: Vec<&Sha256dHash> = entries.iter().map(|(txid, _)| *txid).collect(); let txids: Vec<&Sha256dHash> = entries.iter().map(|(txid, _)| *txid).collect();
let txs = match daemon.gettransactions(&txids) { let txs = match daemon.gettransactions(&txids) {
Ok(txs) => txs, Ok(txs) => txs,
@ -228,6 +226,7 @@ impl Tracker {
assert_eq!(tx.txid(), *txid); assert_eq!(tx.txid(), *txid);
self.add(txid, tx, entry); self.add(txid, tx, entry);
} }
}
timer.observe_duration(); timer.observe_duration();
let timer = self.stats.start_timer("remove"); let timer = self.stats.start_timer("remove");