]> Untitled Git - bdk/commitdiff
[bdk_chain_redesign] Documentation improvements
author志宇 <hello@evanlinjin.me>
Mon, 10 Apr 2023 08:23:10 +0000 (16:23 +0800)
committer志宇 <hello@evanlinjin.me>
Mon, 10 Apr 2023 08:23:10 +0000 (16:23 +0800)
crates/chain/src/chain_data.rs
crates/chain/src/indexed_tx_graph.rs

index 5615b0947047dd372f86b7463bb456bcb1db35b9..aa1e74d4811bcdbda0f9162cb39c8f7e051c93ba 100644 (file)
@@ -271,6 +271,8 @@ impl<A: BlockAnchor> FullTxOut<ObservedAs<A>> {
 
     /// Whether the utxo is/was/will be spendable with chain `tip`.
     ///
+    /// Currently this method does not take into account the locktime.
+    ///
     /// This is the alternative version of [`is_spendable_at`] which depends on `chain_position`
     /// being a [`ObservedAs<A>`] where `A` implements [`BlockAnchor`].
     ///
@@ -286,7 +288,6 @@ impl<A: BlockAnchor> FullTxOut<ObservedAs<A>> {
                     return false;
                 }
             }
-            // [TODO] Why are unconfirmed txs always considered unspendable here?
             ObservedAs::Unconfirmed(_) => return false,
         };
 
index dac05e72562bd098e100306bb42e3344d26b6f04..2de8114a8d36f75bcbd1e9f08b4d7dbcdaeaea3e 100644 (file)
@@ -55,10 +55,11 @@ impl<A: BlockAnchor, IA: Append> Append for IndexedAdditions<A, IA> {
         self.graph_additions.append(other.graph_additions);
         self.index_additions.append(other.index_additions);
         if self.last_height < other.last_height {
-            let last_height = other
-                .last_height
-                .expect("must exist as it is larger than self.last_height");
-            self.last_height.replace(last_height);
+            self.last_height = Some(
+                other
+                    .last_height
+                    .expect("must exist as it is larger than self.last_height"),
+            );
         }
     }
 }