[bdk_chain_redesign] Added methods to LocalChain

Also made the `IndexedTxGraph::index` field public (`index()` and
`index_mut()` methods are no longer needed).
This commit is contained in:
志宇
2023-03-31 22:42:47 +08:00
parent 7810059ed0
commit c09cd2afce
2 changed files with 49 additions and 14 deletions

View File

@@ -58,8 +58,9 @@ impl<A: BlockAnchor, IA: AddAssign> AddAssign for IndexedAdditions<A, IA> {
}
pub struct IndexedTxGraph<A, I> {
/// Transaction index.
pub index: I,
graph: TxGraph<A>,
index: I, // [TODO] Make public
last_height: u32,
}
@@ -79,16 +80,6 @@ impl<A: BlockAnchor, I: TxIndex> IndexedTxGraph<A, I> {
&self.graph
}
/// Get a reference of the internal transaction index.
pub fn index(&self) -> &I {
&self.index
}
/// Get a mutable reference to the internal transaction index.
pub fn index_mut(&mut self) -> &mut I {
&mut self.index
}
/// Applies the [`IndexedAdditions`] to the [`IndexedTxGraph`].
pub fn apply_additions(&mut self, additions: IndexedAdditions<A, I::Additions>) {
let IndexedAdditions {