]> Untitled Git - bdk/commitdiff
doc(wallet): Add docs to explain the lookahead
authorvalued mammal <valuedmammal@protonmail.com>
Fri, 6 Sep 2024 18:24:00 +0000 (14:24 -0400)
committervalued mammal <valuedmammal@protonmail.com>
Mon, 9 Sep 2024 00:37:58 +0000 (20:37 -0400)
crates/wallet/src/wallet/mod.rs
crates/wallet/src/wallet/params.rs
crates/wallet/src/wallet/signer.rs

index 9f12fac4e058dd6a8c761e30dc1c101ab243fbf1..347c9217ad31a4e7fe464fd1894c3a4901fe1d87 100644 (file)
@@ -313,7 +313,7 @@ impl Wallet {
     /// Additionally because this wallet has no internal (change) keychain, all methods that
     /// require a [`KeychainKind`] as input, e.g. [`reveal_next_address`] should only be called
     /// using the [`External`] variant. In most cases passing [`Internal`] is treated as the
-    /// equivalent of [`External`] but can lead to confusing results.
+    /// equivalent of [`External`] but this behavior must not be relied on.
     ///
     /// # Example
     ///
@@ -1070,8 +1070,6 @@ impl Wallet {
     /// **WARNING**: You must persist the changes resulting from one or more calls to this method
     /// if you need the inserted checkpoint data to be reloaded after closing the wallet.
     /// See [`Wallet::reveal_next_address`].
-    ///
-    /// [`commit`]: Self::commit
     pub fn insert_checkpoint(
         &mut self,
         block_id: BlockId,
@@ -2294,9 +2292,7 @@ impl Wallet {
     /// transactions related to your wallet into it.
     ///
     /// After applying updates you should persist the staged wallet changes. For an example of how
-    /// to persist staged wallet changes see [`Wallet::reveal_next_address`]. `
-    ///
-    /// [`commit`]: Self::commit
+    /// to persist staged wallet changes see [`Wallet::reveal_next_address`].
     #[cfg(feature = "std")]
     #[cfg_attr(docsrs, doc(cfg(feature = "std")))]
     pub fn apply_update(&mut self, update: impl Into<Update>) -> Result<(), CannotConnectError> {
index 7f4c8a36c45c935bc03a19bc28b87ab6385add36..7cf3bdd27f422b9f324d5e4ec364150dcf5ce7fa 100644 (file)
@@ -107,7 +107,12 @@ impl CreateParams {
         self
     }
 
-    /// Use custom lookahead value.
+    /// Use a custom `lookahead` value.
+    ///
+    /// The `lookahead` defines a number of script pubkeys to derive over and above the last
+    /// revealed index. Without a lookahead the indexer will miss outputs you own when processing
+    /// transactions whose output script pubkeys lie beyond the last revealed index. In most cases
+    /// the default value [`DEFAULT_LOOKAHEAD`] is sufficient.
     pub fn lookahead(mut self, lookahead: u32) -> Self {
         self.lookahead = lookahead;
         self
@@ -211,7 +216,12 @@ impl LoadParams {
         self
     }
 
-    /// Use custom lookahead value.
+    /// Use a custom `lookahead` value.
+    ///
+    /// The `lookahead` defines a number of script pubkeys to derive over and above the last
+    /// revealed index. Without a lookahead the indexer will miss outputs you own when processing
+    /// transactions whose output script pubkeys lie beyond the last revealed index. In most cases
+    /// the default value [`DEFAULT_LOOKAHEAD`] is sufficient.
     pub fn lookahead(mut self, lookahead: u32) -> Self {
         self.lookahead = lookahead;
         self
index 946ac20def3158992d5ade0ad3ece6bc863f6602..e08a434187091af9927468ab016bbc41b2e6a309 100644 (file)
@@ -751,7 +751,7 @@ pub struct SignOptions {
     /// Whether the signer should trust the `witness_utxo`, if the `non_witness_utxo` hasn't been
     /// provided
     ///
-    /// Defaults to `false` to mitigate the "SegWit bug" which should trick the wallet into
+    /// Defaults to `false` to mitigate the "SegWit bug" which could trick the wallet into
     /// paying a fee larger than expected.
     ///
     /// Some wallets, especially if relatively old, might not provide the `non_witness_utxo` for