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
No known key found for this signature in database
GPG Key ID: 87CAE5FA46917CBB
1 changed files with
8 additions and
2 deletions
-
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); |
|
|
|