From c9467dcbb27bd497006846dcfcefb0c2cf8823c4 Mon Sep 17 00:00:00 2001 From: LLFourn Date: Fri, 29 Dec 2023 16:40:48 +1100 Subject: [PATCH] chore: improve documentation of lookahead --- crates/chain/src/keychain/txout_index.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/chain/src/keychain/txout_index.rs b/crates/chain/src/keychain/txout_index.rs index ed307de7..3287d4f2 100644 --- a/crates/chain/src/keychain/txout_index.rs +++ b/crates/chain/src/keychain/txout_index.rs @@ -117,11 +117,12 @@ impl Indexer for KeychainTxOutIndex { impl KeychainTxOutIndex { /// Construct a [`KeychainTxOutIndex`] with the given `lookahead`. /// - /// The lookahead is the number of scripts to cache ahead of the last revealed script index. - /// This is useful to find outputs you own when processing block data that lie beyond the last - /// revealed index. In certain situations, such as when performing an initial scan of the - /// blockchain during wallet import, it may be uncertain or unknown what the last revealed index - /// is. + /// The `lookahead` is the number of script pubkeys to derive and cache from the internal + /// descriptors over and above the last revealed script index. Without a lookahead the index + /// will miss outputs you own when processing transactions whose output script pubkeys lie + /// beyond the last revealed index. In certain situations, such as when performing an initial + /// scan of the blockchain during wallet import, it may be uncertain or unknown what the index + /// of the last revealed script pubkey actually is. pub fn new(lookahead: u32) -> Self { Self { inner: SpkTxOutIndex::default(),