Skip to content

Commit ef63f87

Browse files
feat: implement set_lookahead_for_all on wallet
1 parent bce96a8 commit ef63f87

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

crates/bdk/src/wallet/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,6 +1986,20 @@ impl<D> Wallet<D> {
19861986
pub fn local_chain(&self) -> &LocalChain {
19871987
&self.chain
19881988
}
1989+
1990+
/// Set lookahead for all keychains.
1991+
///
1992+
/// Passing a lookahead of 0 will result in an error. This is because if we sync
1993+
/// the chain with a lookahead of 0, we would not find any update since we don't
1994+
/// have any scripts stored.
1995+
pub fn set_lookahead_for_all(&mut self, lookahead: u32) -> Result<(), Error> {
1996+
if lookahead == 0 {
1997+
return Err(Error::Generic(
1998+
"lookahead must be greater than 0".to_string(),
1999+
));
2000+
}
2001+
Ok(self.indexed_graph.index.set_lookahead_for_all(lookahead))
2002+
}
19892003
}
19902004

19912005
impl<D> AsRef<bdk_chain::tx_graph::TxGraph<ConfirmationTimeAnchor>> for Wallet<D> {

0 commit comments

Comments
 (0)