[bdk_chain_redesign] Implement OwnedIndexer for indexers
`SpkTxOutIndex` and `KeychainTxOutIndex` now both implement `OwnedIndexer`.
This commit is contained in:
@@ -2,7 +2,7 @@ use core::ops::RangeBounds;
|
||||
|
||||
use crate::{
|
||||
collections::{hash_map::Entry, BTreeMap, BTreeSet, HashMap},
|
||||
indexed_tx_graph::Indexer,
|
||||
indexed_tx_graph::{Indexer, OwnedIndexer},
|
||||
ForEachTxOut,
|
||||
};
|
||||
use bitcoin::{self, OutPoint, Script, Transaction, TxOut, Txid};
|
||||
@@ -75,6 +75,12 @@ impl<I: Clone + Ord + 'static> Indexer for SpkTxOutIndex<I> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<I: Clone + Ord + 'static> OwnedIndexer for SpkTxOutIndex<I> {
|
||||
fn is_spk_owned(&self, spk: &Script) -> bool {
|
||||
self.spk_indices.get(spk).is_some()
|
||||
}
|
||||
}
|
||||
|
||||
/// This macro is used instead of a member function of `SpkTxOutIndex`, which would result in a
|
||||
/// compiler error[E0521]: "borrowed data escapes out of closure" when we attempt to take a
|
||||
/// reference out of the `ForEachTxOut` closure during scanning.
|
||||
|
||||
Reference in New Issue
Block a user