[bdk_chain_redesign] More tweaks and renamings

This commit is contained in:
志宇 2023-04-05 19:13:42 +08:00
parent ddd5e951f5
commit 24cd8c5cc7
No known key found for this signature in database
GPG Key ID: F6345C9837C2BDE8
3 changed files with 7 additions and 7 deletions

View File

@ -190,7 +190,7 @@ impl<A: BlockAnchor, I: TxIndex> IndexedTxGraph<A, I> {
} }
} }
pub fn filter_and_insert_txs<'t, T>( pub fn insert_relevant_txs<'t, T>(
&mut self, &mut self,
txs: T, txs: T,
observation: ObservedAs<A>, observation: ObservedAs<A>,

View File

@ -82,16 +82,16 @@ impl LocalChain {
}; };
// the first block's height to invalidate in the local chain // the first block's height to invalidate in the local chain
let invalidate_from = self.blocks.range(invalidate_lb..).next().map(|(&h, _)| h); let invalidate_from_height = self.blocks.range(invalidate_lb..).next().map(|(&h, _)| h);
// the first block of height to invalidate (if any) should be represented in the update // the first block of height to invalidate (if any) should be represented in the update
if let Some(first_invalid) = invalidate_from { if let Some(first_invalid_height) = invalidate_from_height {
if !update.contains_key(&first_invalid) { if !update.contains_key(&first_invalid_height) {
return Err(UpdateError::NotConnected(first_invalid)); return Err(UpdateError::NotConnected(first_invalid_height));
} }
} }
let invalidated_heights = invalidate_from let invalidated_heights = invalidate_from_height
.into_iter() .into_iter()
.flat_map(|from_height| self.blocks.range(from_height..).map(|(h, _)| h)); .flat_map(|from_height| self.blocks.range(from_height..).map(|(h, _)| h));

View File

@ -21,7 +21,7 @@
//! # use bitcoin::Transaction; //! # use bitcoin::Transaction;
//! # let tx_a = tx_from_hex(RAW_TX_1); //! # let tx_a = tx_from_hex(RAW_TX_1);
//! # let tx_b = tx_from_hex(RAW_TX_2); //! # let tx_b = tx_from_hex(RAW_TX_2);
//! let mut graph = TxGraph::<BlockId>::default(); //! let mut graph: TxGraph = TxGraph::default();
//! //!
//! // preview a transaction insertion (not actually inserted) //! // preview a transaction insertion (not actually inserted)
//! let additions = graph.insert_tx_preview(tx_a); //! let additions = graph.insert_tx_preview(tx_a);