[bdk_chain_redesign] Introduce ChainOracle and TxIndex traits

The chain oracle keeps track of the best chain, while the transaction
index indexes transaction data in relation to script pubkeys.

This commit also includes initial work on `IndexedTxGraph`.
This commit is contained in:
志宇
2023-03-24 15:47:39 +08:00
parent 5ae5fe30eb
commit 61a8606fbc
7 changed files with 315 additions and 5 deletions

View File

@@ -19,7 +19,7 @@ use crate::{
collections::BTreeMap,
sparse_chain::ChainPosition,
tx_graph::TxGraph,
ForEachTxOut,
ForEachTxOut, TxIndexAdditions,
};
#[cfg(feature = "miniscript")]
@@ -85,6 +85,12 @@ impl<K: Ord> DerivationAdditions<K> {
}
}
impl<K: Ord> TxIndexAdditions for DerivationAdditions<K> {
fn append_additions(&mut self, other: Self) {
self.append(other)
}
}
impl<K> Default for DerivationAdditions<K> {
fn default() -> Self {
Self(Default::default())