]> Untitled Git - bdk/commitdiff
[bdk_chain_redesign] More tweaks and renamings
author志宇 <hello@evanlinjin.me>
Wed, 5 Apr 2023 11:13:42 +0000 (19:13 +0800)
committer志宇 <hello@evanlinjin.me>
Wed, 5 Apr 2023 11:13:42 +0000 (19:13 +0800)
crates/chain/src/indexed_tx_graph.rs
crates/chain/src/local_chain.rs
crates/chain/src/tx_graph.rs

index 28b95adfceacfbb9c9fd3bd16d5fc7ba5a75715e..f50f454b3a6d22c410609d447cf2e1d4e2363674 100644 (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,
         txs: T,
         observation: ObservedAs<A>,
index fb7d008d169935d18700b62a529dbecd30d898ee..e1b24ad072fd823550f0e9af5aae9c1fe0442a5a 100644 (file)
@@ -82,16 +82,16 @@ impl LocalChain {
         };
 
         // 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
-        if let Some(first_invalid) = invalidate_from {
-            if !update.contains_key(&first_invalid) {
-                return Err(UpdateError::NotConnected(first_invalid));
+        if let Some(first_invalid_height) = invalidate_from_height {
+            if !update.contains_key(&first_invalid_height) {
+                return Err(UpdateError::NotConnected(first_invalid_height));
             }
         }
 
-        let invalidated_heights = invalidate_from
+        let invalidated_heights = invalidate_from_height
             .into_iter()
             .flat_map(|from_height| self.blocks.range(from_height..).map(|(h, _)| h));
 
index c502d038d9ceec015e027b3e85cc16ded511a6ed..0959456d15255686b7b0e662ec1c4e26a7831d41 100644 (file)
@@ -21,7 +21,7 @@
 //! # use bitcoin::Transaction;
 //! # let tx_a = tx_from_hex(RAW_TX_1);
 //! # 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)
 //! let additions = graph.insert_tx_preview(tx_a);