[bdk_chain_redesign] Simplify TxIndex

This commit is contained in:
志宇
2023-03-31 12:39:00 +08:00
parent a1172def7d
commit a63ffe9739
5 changed files with 86 additions and 124 deletions

View File

@@ -91,8 +91,6 @@ impl<K> Deref for KeychainTxOutIndex<K> {
impl<K: Clone + Ord + Debug + 'static> TxIndex for KeychainTxOutIndex<K> {
type Additions = DerivationAdditions<K>;
type SpkIndex = (K, u32);
fn index_txout(&mut self, outpoint: OutPoint, txout: &TxOut) -> Self::Additions {
self.scan_txout(outpoint, txout)
}
@@ -109,8 +107,8 @@ impl<K: Clone + Ord + Debug + 'static> TxIndex for KeychainTxOutIndex<K> {
self.is_relevant(tx)
}
fn relevant_txouts(&self) -> &BTreeMap<OutPoint, (Self::SpkIndex, TxOut)> {
self.inner.relevant_txouts()
fn is_spk_owned(&self, spk: &Script) -> bool {
self.index_of_spk(spk).is_some()
}
}