Browse Source

Retry in case of mempool update failure

If there is an inconsistency between mempool entries and available
transactions, issue a warning and retry on the next poll.
refactor-mempool
Roman Zeyde 7 years ago
parent
commit
57eb81e15d
No known key found for this signature in database GPG Key ID: 87CAE5FA46917CBB
  1. 10
      src/mempool.rs

10
src/mempool.rs

@ -208,13 +208,19 @@ impl Tracker {
Ok(entry) => Some((txid, entry)),
Err(err) => {
warn!("no mempool entry {}: {}", txid, err); // e.g. new block or RBF
None
None // ignore this transaction for now
}
}
})
.collect();
let txids: Vec<&Sha256dHash> = entries.iter().map(|(txid, _)| *txid).collect();
let txs = daemon.gettransactions(&txids)?;
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);

Loading…
Cancel
Save