* Get mutable index from `IndexedChainGraph`.
* Also add `apply_additions` method to `TxIndex` trait.
&self.index
}
+ /// Get a mutable reference to the internal transaction index.
+ pub fn mut_index(&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 {
+ graph_additions,
+ index_delta,
+ } = additions;
+ self.graph.apply_additions(graph_additions);
+ self.index.apply_additions(index_delta);
+ }
+
/// Insert a `txout` that exists in `outpoint` with the given `observation`.
pub fn insert_txout(
&mut self,
self.scan(tx)
}
+ fn apply_additions(&mut self, additions: Self::Additions) {
+ self.apply_additions(additions)
+ }
+
fn is_tx_relevant(&self, tx: &bitcoin::Transaction) -> bool {
self.is_relevant(tx)
}
self.scan(tx)
}
+ fn apply_additions(&mut self, _additions: Self::Additions) {
+ // This applies nothing.
+ }
+
fn is_tx_relevant(&self, tx: &Transaction) -> bool {
self.is_relevant(tx)
}
.unwrap_or_default()
}
+ /// Apply additions to itself.
+ fn apply_additions(&mut self, additions: Self::Additions);
+
/// A transaction is relevant if it contains a txout with a script_pubkey that we own, or if it
/// spends an already-indexed outpoint that we have previously indexed.
fn is_tx_relevant(&self, tx: &Transaction) -> bool;