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

Don't fail on mempool sync errors

This commit is contained in:
Roman Zeyde 2021-06-04 12:49:37 +03:00
parent 6eb8eb5227
commit 23c775fb47
2 changed files with 9 additions and 4 deletions

View file

@ -75,8 +75,14 @@ impl Mempool {
.collect()
}
pub fn sync(&mut self, daemon: &Daemon) -> Result<()> {
let txids = daemon.get_mempool_txids()?;
pub fn sync(&mut self, daemon: &Daemon) {
let txids = match daemon.get_mempool_txids() {
Ok(txids) => txids,
Err(e) => {
warn!("mempool sync failed: {}", e);
return;
}
};
debug!("loading {} mempool transactions", txids.len());
let new_txids = HashSet::<Txid>::from_iter(txids);
@ -112,7 +118,6 @@ impl Mempool {
added,
removed,
);
Ok(())
}
fn add_entry(&mut self, txid: Txid, tx: Transaction, entry: json::GetMempoolEntryResult) {

View file

@ -67,7 +67,7 @@ impl Tracker {
pub fn sync(&mut self, daemon: &Daemon) -> Result<()> {
self.index.sync(daemon, self.index_batch_size)?;
if !self.ignore_mempool {
self.mempool.sync(daemon)?;
self.mempool.sync(daemon);
}
// TODO: double check tip - and retry on diff
Ok(())