Skip to content

Commit 18fad46

Browse files
committed
add method to check cache misses
1 parent 32d2316 commit 18fad46

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/new_index/schema.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,18 @@ impl ChainQuery {
882882
result
883883
}
884884

885+
pub fn txs_cache_miss(&self, txids: &[Txid]) -> Vec<Txid> {
886+
let mut result = vec![];
887+
if let Ok(cache) = self.txs_cache.lock() {
888+
for txid in txids {
889+
if !cache.contains(txid) {
890+
result.push(*txid);
891+
}
892+
}
893+
}
894+
result
895+
}
896+
885897
pub fn add_txs_to_cache<T: AsRef<[u8]>>(&self, txs: &[(Txid, T)]) {
886898
if let Ok(mut cache) = self.txs_cache.lock() {
887899
for (txid, tx) in txs {

0 commit comments

Comments
 (0)