mirror of
https://github.com/romanz/electrs.git
synced 2025-02-23 14:50:45 +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:
parent
878f81cfeb
commit
af227013f1
1 changed files with 12 additions and 13 deletions
|
@ -213,20 +213,19 @@ impl Tracker {
|
|||
}
|
||||
})
|
||||
.collect();
|
||||
if entries.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
let txids: Vec<&Sha256dHash> = entries.iter().map(|(txid, _)| *txid).collect();
|
||||
let txs = match daemon.gettransactions(&txids) {
|
||||
Ok(txs) => txs,
|
||||
Err(err) => {
|
||||
warn!("failed to get transactions {:?}: {}", txids, err); // e.g. new block or RBF
|
||||
return Ok(()); // keep the mempool until next update()
|
||||
if !entries.is_empty() {
|
||||
let txids: Vec<&Sha256dHash> = entries.iter().map(|(txid, _)| *txid).collect();
|
||||
let txs = match daemon.gettransactions(&txids) {
|
||||
Ok(txs) => txs,
|
||||
Err(err) => {
|
||||
warn!("failed to get transactions {:?}: {}", txids, err); // e.g. new block or RBF
|
||||
return Ok(()); // keep the mempool until next update()
|
||||
}
|
||||
};
|
||||
for ((txid, entry), tx) in entries.into_iter().zip(txs.into_iter()) {
|
||||
assert_eq!(tx.txid(), *txid);
|
||||
self.add(txid, tx, entry);
|
||||
}
|
||||
};
|
||||
for ((txid, entry), tx) in entries.into_iter().zip(txs.into_iter()) {
|
||||
assert_eq!(tx.txid(), *txid);
|
||||
self.add(txid, tx, entry);
|
||||
}
|
||||
timer.observe_duration();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue