Skip to content

Commit 1e42232

Browse files
committed
Update BDK sync parameters
1 parent 873fdc5 commit 1e42232

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

src/lib.rs

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ const DEFAULT_FEE_RATE_CACHE_UPDATE_INTERVAL_SECS: u64 = 60 * 10;
169169
const DEFAULT_LOG_LEVEL: LogLevel = LogLevel::Debug;
170170

171171
// The 'stop gap' parameter used by BDK's wallet sync. This seems to configure the threshold
172-
// number of blocks after which BDK stops looking for scripts belonging to the wallet.
172+
// number of derivation indexes after which BDK stops looking for new scripts belonging to the wallet.
173173
const BDK_CLIENT_STOP_GAP: usize = 20;
174174

175175
// The number of concurrent requests made against the API provider.
176-
const BDK_CLIENT_CONCURRENCY: u8 = 8;
176+
const BDK_CLIENT_CONCURRENCY: u8 = 4;
177177

178178
// The default Esplora server we're using.
179179
const DEFAULT_ESPLORA_SERVER_URL: &str = "https://blockstream.info/api";
@@ -354,11 +354,17 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
354354
_ = onchain_wallet_sync_interval.tick() => {
355355
let now = Instant::now();
356356
match wallet.sync().await {
357-
Ok(()) => log_trace!(
357+
Ok(()) => {
358+
println!(
359+
"Background sync of on-chain wallet finished in {}ms.",
360+
now.elapsed().as_millis()
361+
);
362+
log_trace!(
358363
sync_logger,
359364
"Background sync of on-chain wallet finished in {}ms.",
360365
now.elapsed().as_millis()
361-
),
366+
);
367+
}
362368
Err(err) => {
363369
log_error!(
364370
sync_logger,
@@ -371,11 +377,17 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
371377
_ = fee_rate_update_interval.tick() => {
372378
let now = Instant::now();
373379
match wallet.update_fee_estimates().await {
374-
Ok(()) => log_trace!(
380+
Ok(()) => {
381+
println!(
382+
"Background update of fee rate cache finished in {}ms.",
383+
now.elapsed().as_millis()
384+
);
385+
log_trace!(
375386
sync_logger,
376387
"Background update of fee rate cache finished in {}ms.",
377388
now.elapsed().as_millis()
378-
),
389+
);
390+
}
379391
Err(err) => {
380392
log_error!(
381393
sync_logger,
@@ -414,11 +426,17 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
414426
];
415427
let now = Instant::now();
416428
match tx_sync.sync(confirmables).await {
417-
Ok(()) => log_trace!(
429+
Ok(()) => {
430+
println!(
431+
"Background sync of Lightning wallet finished in {}ms.",
432+
now.elapsed().as_millis()
433+
);
434+
log_trace!(
418435
sync_logger,
419436
"Background sync of Lightning wallet finished in {}ms.",
420437
now.elapsed().as_millis()
421-
),
438+
);
439+
}
422440
Err(e) => {
423441
log_error!(sync_logger, "Background sync of Lightning wallet failed: {}", e)
424442
}

0 commit comments

Comments
 (0)