Skip to content

Commit 155566e

Browse files
authored
feat(wallet): set lookahead with Wallet:load
1 parent bf8e48a commit 155566e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bdk-ffi/src/wallet.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ impl Wallet {
7070
/// Build Wallet by loading from persistence.
7171
//
7272
// Note that the descriptor secret keys are not persisted to the db.
73-
#[uniffi::constructor]
73+
#[uniffi::constructor(default(lookahead = 25))]
7474
pub fn load(
7575
descriptor: Arc<Descriptor>,
7676
change_descriptor: Arc<Descriptor>,
7777
persister: Arc<Persister>,
78+
lookahead: u32,
7879
) -> Result<Wallet, LoadWithPersistError> {
7980
let descriptor = descriptor.to_string_with_secret();
8081
let change_descriptor = change_descriptor.to_string_with_secret();
@@ -84,6 +85,7 @@ impl Wallet {
8485
let wallet: PersistedWallet<PersistenceType> = BdkWallet::load()
8586
.descriptor(KeychainKind::External, Some(descriptor))
8687
.descriptor(KeychainKind::Internal, Some(change_descriptor))
88+
.lookahead(lookahead)
8789
.extract_keys()
8890
.load_wallet(deref)
8991
.map_err(|e| LoadWithPersistError::Persist {
@@ -445,7 +447,7 @@ impl Wallet {
445447
}
446448

447449
impl Wallet {
448-
pub(crate) fn get_wallet(&self) -> MutexGuard<PersistedWallet<PersistenceType>> {
450+
pub(crate) fn get_wallet(&self) -> MutexGuard<'_, PersistedWallet<PersistenceType>> {
449451
self.inner_mutex.lock().expect("wallet")
450452
}
451453
}

0 commit comments

Comments
 (0)