Skip to content

Commit 2cf46a2

Browse files
committed
Merge #1596: doc(wallet): Add docs to explain the lookahead
028f687 doc(wallet): Add docs to explain the lookahead (valued mammal) Pull request description: Adds clarifying language to `CreateParams` and `LoadParams` regarding the `lookahead` parameter. Commit 028f687 also includes some minor documentation fixes. If anyone is aware of any more documentation flaws that need attention I'm happy to add them here. cc #1540 ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing ACKs for top commit: LagginTimes: ACK 028f687 oleonardolima: ACK 028f687 evanlinjin: ACK 028f687 Tree-SHA512: 971d09652948ed2e2dc86d255cfd18607d96b0806aa0e990190cd1d7035c6660ea2ac1092ef2c6c209e61920c0d4ff9d8c0a900bcc74a8662546d284fec3218f
2 parents 9470713 + 028f687 commit 2cf46a2

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

crates/wallet/src/wallet/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ impl Wallet {
311311
/// Additionally because this wallet has no internal (change) keychain, all methods that
312312
/// require a [`KeychainKind`] as input, e.g. [`reveal_next_address`] should only be called
313313
/// using the [`External`] variant. In most cases passing [`Internal`] is treated as the
314-
/// equivalent of [`External`] but can lead to confusing results.
314+
/// equivalent of [`External`] but this behavior must not be relied on.
315315
///
316316
/// # Example
317317
///
@@ -1071,8 +1071,6 @@ impl Wallet {
10711071
/// **WARNING**: You must persist the changes resulting from one or more calls to this method
10721072
/// if you need the inserted checkpoint data to be reloaded after closing the wallet.
10731073
/// See [`Wallet::reveal_next_address`].
1074-
///
1075-
/// [`commit`]: Self::commit
10761074
pub fn insert_checkpoint(
10771075
&mut self,
10781076
block_id: BlockId,
@@ -2303,9 +2301,7 @@ impl Wallet {
23032301
/// transactions related to your wallet into it.
23042302
///
23052303
/// After applying updates you should persist the staged wallet changes. For an example of how
2306-
/// to persist staged wallet changes see [`Wallet::reveal_next_address`]. `
2307-
///
2308-
/// [`commit`]: Self::commit
2304+
/// to persist staged wallet changes see [`Wallet::reveal_next_address`].
23092305
#[cfg(feature = "std")]
23102306
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
23112307
pub fn apply_update(&mut self, update: impl Into<Update>) -> Result<(), CannotConnectError> {

crates/wallet/src/wallet/params.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ impl CreateParams {
107107
self
108108
}
109109

110-
/// Use custom lookahead value.
110+
/// Use a custom `lookahead` value.
111+
///
112+
/// The `lookahead` defines a number of script pubkeys to derive over and above the last
113+
/// revealed index. Without a lookahead the indexer will miss outputs you own when processing
114+
/// transactions whose output script pubkeys lie beyond the last revealed index. In most cases
115+
/// the default value [`DEFAULT_LOOKAHEAD`] is sufficient.
111116
pub fn lookahead(mut self, lookahead: u32) -> Self {
112117
self.lookahead = lookahead;
113118
self
@@ -211,7 +216,12 @@ impl LoadParams {
211216
self
212217
}
213218

214-
/// Use custom lookahead value.
219+
/// Use a custom `lookahead` value.
220+
///
221+
/// The `lookahead` defines a number of script pubkeys to derive over and above the last
222+
/// revealed index. Without a lookahead the indexer will miss outputs you own when processing
223+
/// transactions whose output script pubkeys lie beyond the last revealed index. In most cases
224+
/// the default value [`DEFAULT_LOOKAHEAD`] is sufficient.
215225
pub fn lookahead(mut self, lookahead: u32) -> Self {
216226
self.lookahead = lookahead;
217227
self

crates/wallet/src/wallet/signer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ pub struct SignOptions {
751751
/// Whether the signer should trust the `witness_utxo`, if the `non_witness_utxo` hasn't been
752752
/// provided
753753
///
754-
/// Defaults to `false` to mitigate the "SegWit bug" which should trick the wallet into
754+
/// Defaults to `false` to mitigate the "SegWit bug" which could trick the wallet into
755755
/// paying a fee larger than expected.
756756
///
757757
/// Some wallets, especially if relatively old, might not provide the `non_witness_utxo` for

0 commit comments

Comments
 (0)