From 1b02d2b481a559f64514678a7c5d45f7ce008246 Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Mon, 4 Nov 2024 13:40:52 +0700 Subject: [PATCH] fix: decrease BDK_CLIENT_STOP_GAP, re-enable incremental sync --- src/chain/mod.rs | 4 ++-- src/config.rs | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/chain/mod.rs b/src/chain/mod.rs index e951fc10f..097a04ca1 100644 --- a/src/chain/mod.rs +++ b/src/chain/mod.rs @@ -417,8 +417,8 @@ impl ChainSource { let res = { // If this is our first sync, do a full scan with the configured gap limit. // Otherwise just do an incremental sync. - // Alby: always do full sync - let incremental_sync = false; //node_metrics.read().unwrap().latest_onchain_wallet_sync_timestamp.is_some(); + let incremental_sync = + node_metrics.read().unwrap().latest_onchain_wallet_sync_timestamp.is_some(); log_info!(logger, "Starting onchain wallet sync"); diff --git a/src/config.rs b/src/config.rs index 473261059..8624b9293 100644 --- a/src/config.rs +++ b/src/config.rs @@ -36,12 +36,15 @@ pub(crate) const ENABLE_BACKGROUND_SYNC: bool = false; // The 'stop gap' parameter used by BDK's wallet sync. This seems to configure the threshold // number of derivation indexes after which BDK stops looking for new scripts belonging to the wallet. -pub(crate) const BDK_CLIENT_STOP_GAP: usize = 20; +// Alby: decreased to do less unnecessary requests. The actual amount is twice this (for internal + external addresses) +// but also is based on the BDK_CLIENT_CONCURRENCY below (using less than 4 has no effect). +pub(crate) const BDK_CLIENT_STOP_GAP: usize = 1; // 20 // The number of concurrent requests made against the API provider. pub(crate) const BDK_CLIENT_CONCURRENCY: usize = 4; // The timeout after which we abandon retrying failed payments. +// Alby: increase this for extra retries pub(crate) const LDK_PAYMENT_RETRY_TIMEOUT: Duration = Duration::from_secs(50); // (10); // The interval (in block height) after which we retry archiving fully resolved channel monitors.