From 760e5e7f6a8f329109daff52e8f6427882927b97 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Thu, 29 Jan 2026 11:09:40 +0100 Subject: [PATCH 1/2] Make sync timeouts configurable Previously, the timeouts applied to chain syncing weren't configurable to users. While historically there were good reasons for this (mostly to avoid leaving the Node in a blocked state for extended periods during chain syncing), by now we should be good to let the users configure timeouts ~freely, if they deem it fit. Here we allow for exactly that. Signed-off-by: Elias Rohrer --- bindings/ldk_node.udl | 10 ++++ src/chain/bitcoind.rs | 7 +-- src/chain/electrum.rs | 60 ++++++++++++++++-------- src/chain/esplora.rs | 27 ++++++----- src/config.rs | 81 ++++++++++++++++++++++++++------- src/ffi/types.rs | 2 +- tests/common/mod.rs | 6 ++- tests/integration_tests_rust.rs | 15 ++++-- 8 files changed, 149 insertions(+), 59 deletions(-) diff --git a/bindings/ldk_node.udl b/bindings/ldk_node.udl index c881dbe09..6bd031379 100644 --- a/bindings/ldk_node.udl +++ b/bindings/ldk_node.udl @@ -26,12 +26,22 @@ dictionary BackgroundSyncConfig { u64 fee_rate_cache_update_interval_secs; }; +dictionary SyncTimeoutsConfig { + u64 onchain_wallet_sync_timeout_secs; + u64 lightning_wallet_sync_timeout_secs; + u64 fee_rate_cache_update_timeout_secs; + u64 tx_broadcast_timeout_secs; + u8 per_request_timeout_secs; +}; + dictionary EsploraSyncConfig { BackgroundSyncConfig? background_sync_config; + SyncTimeoutsConfig timeouts_config; }; dictionary ElectrumSyncConfig { BackgroundSyncConfig? background_sync_config; + SyncTimeoutsConfig timeouts_config; }; dictionary LSPS2ServiceConfig { diff --git a/src/chain/bitcoind.rs b/src/chain/bitcoind.rs index d9f43ee17..8a7167022 100644 --- a/src/chain/bitcoind.rs +++ b/src/chain/bitcoind.rs @@ -31,7 +31,8 @@ use serde::Serialize; use super::WalletSyncStatus; use crate::config::{ - BitcoindRestClientConfig, Config, FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS, TX_BROADCAST_TIMEOUT_SECS, + BitcoindRestClientConfig, Config, DEFAULT_FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS, + DEFAULT_TX_BROADCAST_TIMEOUT_SECS, }; use crate::fee_estimator::{ apply_post_estimation_adjustments, get_all_conf_targets, get_num_block_defaults_for_target, @@ -466,7 +467,7 @@ impl BitcoindChainSource { macro_rules! get_fee_rate_update { ($estimation_fut:expr) => {{ let update_res = tokio::time::timeout( - Duration::from_secs(FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS), + Duration::from_secs(DEFAULT_FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS), $estimation_fut, ) .await @@ -584,7 +585,7 @@ impl BitcoindChainSource { for tx in &package { let txid = tx.compute_txid(); let timeout_fut = tokio::time::timeout( - Duration::from_secs(TX_BROADCAST_TIMEOUT_SECS), + Duration::from_secs(DEFAULT_TX_BROADCAST_TIMEOUT_SECS), self.api_client.broadcast_transaction(tx), ); match timeout_fut.await { diff --git a/src/chain/electrum.rs b/src/chain/electrum.rs index 21e66f3a6..7b08c3845 100644 --- a/src/chain/electrum.rs +++ b/src/chain/electrum.rs @@ -24,10 +24,7 @@ use lightning::util::ser::Writeable; use lightning_transaction_sync::ElectrumSyncClient; use super::WalletSyncStatus; -use crate::config::{ - Config, ElectrumSyncConfig, BDK_CLIENT_STOP_GAP, BDK_WALLET_SYNC_TIMEOUT_SECS, - FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS, LDK_WALLET_SYNC_TIMEOUT_SECS, TX_BROADCAST_TIMEOUT_SECS, -}; +use crate::config::{Config, ElectrumSyncConfig, BDK_CLIENT_STOP_GAP}; use crate::error::Error; use crate::fee_estimator::{ apply_post_estimation_adjustments, get_all_conf_targets, get_num_block_defaults_for_target, @@ -41,7 +38,6 @@ use crate::NodeMetrics; const BDK_ELECTRUM_CLIENT_BATCH_SIZE: usize = 5; const ELECTRUM_CLIENT_NUM_RETRIES: u8 = 3; -const ELECTRUM_CLIENT_TIMEOUT_SECS: u8 = 10; pub(super) struct ElectrumChainSource { server_url: String, @@ -82,6 +78,7 @@ impl ElectrumChainSource { pub(super) fn start(&self, runtime: Arc) -> Result<(), Error> { self.electrum_runtime_status.write().unwrap().start( self.server_url.clone(), + self.sync_config.clone(), Arc::clone(&runtime), Arc::clone(&self.config), Arc::clone(&self.logger), @@ -318,13 +315,14 @@ impl ElectrumRuntimeStatus { } pub(super) fn start( - &mut self, server_url: String, runtime: Arc, config: Arc, - logger: Arc, + &mut self, server_url: String, sync_config: ElectrumSyncConfig, runtime: Arc, + config: Arc, logger: Arc, ) -> Result<(), Error> { match self { Self::Stopped { pending_registered_txs, pending_registered_outputs } => { let client = Arc::new(ElectrumRuntimeClient::new( - server_url.clone(), + server_url, + sync_config, runtime, config, logger, @@ -380,6 +378,7 @@ impl ElectrumRuntimeStatus { struct ElectrumRuntimeClient { electrum_client: Arc, + sync_config: ElectrumSyncConfig, bdk_electrum_client: Arc>>, tx_sync: Arc>>, runtime: Arc, @@ -389,11 +388,12 @@ struct ElectrumRuntimeClient { impl ElectrumRuntimeClient { fn new( - server_url: String, runtime: Arc, config: Arc, logger: Arc, + server_url: String, sync_config: ElectrumSyncConfig, runtime: Arc, + config: Arc, logger: Arc, ) -> Result { let electrum_config = ElectrumConfigBuilder::new() .retry(ELECTRUM_CLIENT_NUM_RETRIES) - .timeout(Some(ELECTRUM_CLIENT_TIMEOUT_SECS)) + .timeout(Some(sync_config.timeouts_config.per_request_timeout_secs)) .build(); let electrum_client = Arc::new( @@ -409,7 +409,15 @@ impl ElectrumRuntimeClient { Error::ConnectionFailed })?, ); - Ok(Self { electrum_client, bdk_electrum_client, tx_sync, runtime, config, logger }) + Ok(Self { + electrum_client, + sync_config, + bdk_electrum_client, + tx_sync, + runtime, + config, + logger, + }) } async fn sync_confirmables( @@ -419,8 +427,12 @@ impl ElectrumRuntimeClient { let tx_sync = Arc::clone(&self.tx_sync); let spawn_fut = self.runtime.spawn_blocking(move || tx_sync.sync(confirmables)); - let timeout_fut = - tokio::time::timeout(Duration::from_secs(LDK_WALLET_SYNC_TIMEOUT_SECS), spawn_fut); + let timeout_fut = tokio::time::timeout( + Duration::from_secs( + self.sync_config.timeouts_config.lightning_wallet_sync_timeout_secs, + ), + spawn_fut, + ); let res = timeout_fut .await @@ -461,8 +473,10 @@ impl ElectrumRuntimeClient { true, ) }); - let wallet_sync_timeout_fut = - tokio::time::timeout(Duration::from_secs(BDK_WALLET_SYNC_TIMEOUT_SECS), spawn_fut); + let wallet_sync_timeout_fut = tokio::time::timeout( + Duration::from_secs(self.sync_config.timeouts_config.onchain_wallet_sync_timeout_secs), + spawn_fut, + ); wallet_sync_timeout_fut .await @@ -490,8 +504,10 @@ impl ElectrumRuntimeClient { let spawn_fut = self.runtime.spawn_blocking(move || { bdk_electrum_client.sync(request, BDK_ELECTRUM_CLIENT_BATCH_SIZE, true) }); - let wallet_sync_timeout_fut = - tokio::time::timeout(Duration::from_secs(BDK_WALLET_SYNC_TIMEOUT_SECS), spawn_fut); + let wallet_sync_timeout_fut = tokio::time::timeout( + Duration::from_secs(self.sync_config.timeouts_config.onchain_wallet_sync_timeout_secs), + spawn_fut, + ); wallet_sync_timeout_fut .await @@ -517,8 +533,10 @@ impl ElectrumRuntimeClient { let spawn_fut = self.runtime.spawn_blocking(move || electrum_client.transaction_broadcast(&tx)); - let timeout_fut = - tokio::time::timeout(Duration::from_secs(TX_BROADCAST_TIMEOUT_SECS), spawn_fut); + let timeout_fut = tokio::time::timeout( + Duration::from_secs(self.sync_config.timeouts_config.tx_broadcast_timeout_secs), + spawn_fut, + ); match timeout_fut.await { Ok(res) => match res { @@ -565,7 +583,9 @@ impl ElectrumRuntimeClient { let spawn_fut = self.runtime.spawn_blocking(move || electrum_client.batch_call(&batch)); let timeout_fut = tokio::time::timeout( - Duration::from_secs(FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS), + Duration::from_secs( + self.sync_config.timeouts_config.fee_rate_cache_update_timeout_secs, + ), spawn_fut, ); diff --git a/src/chain/esplora.rs b/src/chain/esplora.rs index 8ab941888..245db72f6 100644 --- a/src/chain/esplora.rs +++ b/src/chain/esplora.rs @@ -17,11 +17,7 @@ use lightning::util::ser::Writeable; use lightning_transaction_sync::EsploraSyncClient; use super::WalletSyncStatus; -use crate::config::{ - Config, EsploraSyncConfig, BDK_CLIENT_CONCURRENCY, BDK_CLIENT_STOP_GAP, - BDK_WALLET_SYNC_TIMEOUT_SECS, DEFAULT_ESPLORA_CLIENT_TIMEOUT_SECS, - FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS, LDK_WALLET_SYNC_TIMEOUT_SECS, TX_BROADCAST_TIMEOUT_SECS, -}; +use crate::config::{Config, EsploraSyncConfig, BDK_CLIENT_CONCURRENCY, BDK_CLIENT_STOP_GAP}; use crate::fee_estimator::{ apply_post_estimation_adjustments, get_all_conf_targets, get_num_block_defaults_for_target, OnchainFeeEstimator, @@ -51,7 +47,8 @@ impl EsploraChainSource { logger: Arc, node_metrics: Arc>, ) -> Self { let mut client_builder = esplora_client::Builder::new(&server_url); - client_builder = client_builder.timeout(DEFAULT_ESPLORA_CLIENT_TIMEOUT_SECS); + client_builder = + client_builder.timeout(sync_config.timeouts_config.per_request_timeout_secs as u64); for (header_name, header_value) in &headers { client_builder = client_builder.header(header_name, header_value); @@ -183,14 +180,18 @@ impl EsploraChainSource { if incremental_sync { let sync_request = onchain_wallet.get_incremental_sync_request(); let wallet_sync_timeout_fut = tokio::time::timeout( - Duration::from_secs(BDK_WALLET_SYNC_TIMEOUT_SECS), + Duration::from_secs( + self.sync_config.timeouts_config.onchain_wallet_sync_timeout_secs, + ), self.esplora_client.sync(sync_request, BDK_CLIENT_CONCURRENCY), ); get_and_apply_wallet_update!(wallet_sync_timeout_fut) } else { let full_scan_request = onchain_wallet.get_full_scan_request(); let wallet_sync_timeout_fut = tokio::time::timeout( - Duration::from_secs(BDK_WALLET_SYNC_TIMEOUT_SECS), + Duration::from_secs( + self.sync_config.timeouts_config.onchain_wallet_sync_timeout_secs, + ), self.esplora_client.full_scan( full_scan_request, BDK_CLIENT_STOP_GAP, @@ -240,7 +241,9 @@ impl EsploraChainSource { ]; let timeout_fut = tokio::time::timeout( - Duration::from_secs(LDK_WALLET_SYNC_TIMEOUT_SECS), + Duration::from_secs( + self.sync_config.timeouts_config.lightning_wallet_sync_timeout_secs as u64, + ), self.tx_sync.sync(confirmables), ); let now = Instant::now(); @@ -278,7 +281,9 @@ impl EsploraChainSource { pub(crate) async fn update_fee_rate_estimates(&self) -> Result<(), Error> { let now = Instant::now(); let estimates = tokio::time::timeout( - Duration::from_secs(FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS), + Duration::from_secs( + self.sync_config.timeouts_config.fee_rate_cache_update_timeout_secs, + ), self.esplora_client.get_fee_estimates(), ) .await @@ -351,7 +356,7 @@ impl EsploraChainSource { for tx in &package { let txid = tx.compute_txid(); let timeout_fut = tokio::time::timeout( - Duration::from_secs(TX_BROADCAST_TIMEOUT_SECS), + Duration::from_secs(self.sync_config.timeouts_config.tx_broadcast_timeout_secs), self.esplora_client.broadcast(tx), ); match timeout_fut.await { diff --git a/src/config.rs b/src/config.rs index 6c9d1640a..47493bca0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -29,6 +29,21 @@ const DEFAULT_FEE_RATE_CACHE_UPDATE_INTERVAL_SECS: u64 = 60 * 10; const DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER: u64 = 3; const DEFAULT_ANCHOR_PER_CHANNEL_RESERVE_SATS: u64 = 25_000; +// The default timeout after which we abort a wallet syncing operation. +const DEFAULT_BDK_WALLET_SYNC_TIMEOUT_SECS: u64 = 20; + +// The default timeout after which we abort a wallet syncing operation. +const DEFAULT_LDK_WALLET_SYNC_TIMEOUT_SECS: u64 = 10; + +// The default timeout after which we abort a fee rate cache update operation. +pub(crate) const DEFAULT_FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS: u64 = 5; + +// The default timeout after which we abort a transaction broadcast operation. +pub(crate) const DEFAULT_TX_BROADCAST_TIMEOUT_SECS: u64 = 5; + +// The default {Esplora,Electrum} client timeout we're using. +const DEFAULT_PER_REQUEST_TIMEOUT_SECS: u8 = 10; + /// The default log level. pub const DEFAULT_LOG_LEVEL: LogLevel = LogLevel::Debug; @@ -41,9 +56,6 @@ pub const DEFAULT_STORAGE_DIR_PATH: &str = "/tmp/ldk_node"; // The default Esplora server we're using. pub(crate) const DEFAULT_ESPLORA_SERVER_URL: &str = "https://blockstream.info/api"; -// The default Esplora client timeout we're using. -pub(crate) const DEFAULT_ESPLORA_CLIENT_TIMEOUT_SECS: u64 = 10; - // 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; @@ -69,24 +81,12 @@ pub(crate) const NODE_ANN_BCAST_INTERVAL: Duration = Duration::from_secs(60 * 60 // The lower limit which we apply to any configured wallet sync intervals. pub(crate) const WALLET_SYNC_INTERVAL_MINIMUM_SECS: u64 = 10; -// The timeout after which we abort a wallet syncing operation. -pub(crate) const BDK_WALLET_SYNC_TIMEOUT_SECS: u64 = 20; - -// The timeout after which we abort a wallet syncing operation. -pub(crate) const LDK_WALLET_SYNC_TIMEOUT_SECS: u64 = 10; - // The timeout after which we give up waiting on LDK's event handler to exit on shutdown. pub(crate) const LDK_EVENT_HANDLER_SHUTDOWN_TIMEOUT_SECS: u64 = 30; // The timeout after which we give up waiting on a background task to exit on shutdown. pub(crate) const BACKGROUND_TASK_SHUTDOWN_TIMEOUT_SECS: u64 = 5; -// The timeout after which we abort a fee rate cache update operation. -pub(crate) const FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS: u64 = 5; - -// The timeout after which we abort a transaction broadcast operation. -pub(crate) const TX_BROADCAST_TIMEOUT_SECS: u64 = 5; - // The maximum encoded size of an RGS snapshot we'll accept. // In practice the maximum we see is around 4MiB. pub(crate) const RGS_SNAPSHOT_MAX_SIZE: usize = 15 * 1024 * 1024; @@ -381,6 +381,43 @@ impl Default for BackgroundSyncConfig { } } +/// Timeout-related parameters for syncing the Lightning and on-chain wallets. +/// +/// ### Defaults +/// +/// | Parameter | Value | +/// |----------------------------------------|--------------------| +/// | `onchain_wallet_sync_timeout_secs` | 20 | +/// | `lightning_wallet_sync_timeout_secs` | 10 | +/// | `fee_rate_cache_update_timeout_secs` | 5 | +/// | `tx_broadcast_timeout_secs` | 5 | +/// | `per_request_timeout_secs` | 10 | +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub struct SyncTimeoutsConfig { + /// The timeout after which we abort syncing the onchain wallet. + pub onchain_wallet_sync_timeout_secs: u64, + /// The timeout after which we abort syncing the LDK wallet. + pub lightning_wallet_sync_timeout_secs: u64, + /// The timeout after which we abort updating the fee rate cache. + pub fee_rate_cache_update_timeout_secs: u64, + /// The timeout after which we abort broadcasting a transaction. + pub tx_broadcast_timeout_secs: u64, + /// The per-request timeout after which we abort a single Electrum or Esplora API request. + pub per_request_timeout_secs: u8, +} + +impl Default for SyncTimeoutsConfig { + fn default() -> Self { + Self { + onchain_wallet_sync_timeout_secs: DEFAULT_BDK_WALLET_SYNC_TIMEOUT_SECS, + lightning_wallet_sync_timeout_secs: DEFAULT_LDK_WALLET_SYNC_TIMEOUT_SECS, + fee_rate_cache_update_timeout_secs: DEFAULT_FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS, + tx_broadcast_timeout_secs: DEFAULT_TX_BROADCAST_TIMEOUT_SECS, + per_request_timeout_secs: DEFAULT_PER_REQUEST_TIMEOUT_SECS, + } + } +} + /// Configuration for syncing with an Esplora backend. /// /// Background syncing is enabled by default, using the default values specified in @@ -394,11 +431,16 @@ pub struct EsploraSyncConfig { /// /// [`Node::sync_wallets`]: crate::Node::sync_wallets pub background_sync_config: Option, + /// Sync timeouts configuration. + pub timeouts_config: SyncTimeoutsConfig, } impl Default for EsploraSyncConfig { fn default() -> Self { - Self { background_sync_config: Some(BackgroundSyncConfig::default()) } + Self { + background_sync_config: Some(BackgroundSyncConfig::default()), + timeouts_config: SyncTimeoutsConfig::default(), + } } } @@ -415,11 +457,16 @@ pub struct ElectrumSyncConfig { /// /// [`Node::sync_wallets`]: crate::Node::sync_wallets pub background_sync_config: Option, + /// Sync timeouts configuration. + pub timeouts_config: SyncTimeoutsConfig, } impl Default for ElectrumSyncConfig { fn default() -> Self { - Self { background_sync_config: Some(BackgroundSyncConfig::default()) } + Self { + background_sync_config: Some(BackgroundSyncConfig::default()), + timeouts_config: SyncTimeoutsConfig::default(), + } } } diff --git a/src/ffi/types.rs b/src/ffi/types.rs index f63a715e1..22dc47c7b 100644 --- a/src/ffi/types.rs +++ b/src/ffi/types.rs @@ -46,7 +46,7 @@ pub use vss_client::headers::{VssHeaderProvider, VssHeaderProviderError}; use crate::builder::sanitize_alias; pub use crate::config::{ default_config, AnchorChannelsConfig, BackgroundSyncConfig, ElectrumSyncConfig, - EsploraSyncConfig, MaxDustHTLCExposure, + EsploraSyncConfig, MaxDustHTLCExposure, SyncTimeoutsConfig, }; pub use crate::entropy::{generate_entropy_mnemonic, EntropyError, NodeEntropy, WordCount}; use crate::error::Error; diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 96f58297c..5f6657260 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -370,12 +370,14 @@ pub(crate) fn setup_node_for_async_payments( match chain_source { TestChainSource::Esplora(electrsd) => { let esplora_url = format!("http://{}", electrsd.esplora_url.as_ref().unwrap()); - let sync_config = EsploraSyncConfig { background_sync_config: None }; + let mut sync_config = EsploraSyncConfig::default(); + sync_config.background_sync_config = None; builder.set_chain_source_esplora(esplora_url.clone(), Some(sync_config)); }, TestChainSource::Electrum(electrsd) => { let electrum_url = format!("tcp://{}", electrsd.electrum_url); - let sync_config = ElectrumSyncConfig { background_sync_config: None }; + let mut sync_config = ElectrumSyncConfig::default(); + sync_config.background_sync_config = None; builder.set_chain_source_electrum(electrum_url.clone(), Some(sync_config)); }, TestChainSource::BitcoindRpcSync(bitcoind) => { diff --git a/tests/integration_tests_rust.rs b/tests/integration_tests_rust.rs index 4e94dd044..605dd0613 100644 --- a/tests/integration_tests_rust.rs +++ b/tests/integration_tests_rust.rs @@ -158,7 +158,8 @@ async fn multi_hop_sending() { let mut nodes = Vec::new(); for _ in 0..5 { let config = random_config(true); - let sync_config = EsploraSyncConfig { background_sync_config: None }; + let mut sync_config = EsploraSyncConfig::default(); + sync_config.background_sync_config = None; setup_builder!(builder, config.node_config); builder.set_chain_source_esplora(esplora_url.clone(), Some(sync_config)); let node = builder.build(config.node_entropy.into()).unwrap(); @@ -256,7 +257,8 @@ async fn start_stop_reinit() { let test_sync_store = TestSyncStore::new(config.node_config.storage_dir_path.clone().into()); - let sync_config = EsploraSyncConfig { background_sync_config: None }; + let mut sync_config = EsploraSyncConfig::default(); + sync_config.background_sync_config = None; setup_builder!(builder, config.node_config); builder.set_chain_source_esplora(esplora_url.clone(), Some(sync_config)); @@ -1709,7 +1711,8 @@ async fn do_lsps2_client_service_integration(client_trusts_lsp: bool) { let (bitcoind, electrsd) = setup_bitcoind_and_electrsd(); let esplora_url = format!("http://{}", electrsd.esplora_url.as_ref().unwrap()); - let sync_config = EsploraSyncConfig { background_sync_config: None }; + let mut sync_config = EsploraSyncConfig::default(); + sync_config.background_sync_config = None; // Setup three nodes: service, client, and payer let channel_opening_fee_ppm = 10_000; @@ -2026,7 +2029,8 @@ async fn lsps2_client_trusts_lsp() { let esplora_url = format!("http://{}", electrsd.esplora_url.as_ref().unwrap()); - let sync_config = EsploraSyncConfig { background_sync_config: None }; + let mut sync_config = EsploraSyncConfig::default(); + sync_config.background_sync_config = None; // Setup three nodes: service, client, and payer let channel_opening_fee_ppm = 10_000; @@ -2199,7 +2203,8 @@ async fn lsps2_lsp_trusts_client_but_client_does_not_claim() { let esplora_url = format!("http://{}", electrsd.esplora_url.as_ref().unwrap()); - let sync_config = EsploraSyncConfig { background_sync_config: None }; + let mut sync_config = EsploraSyncConfig::default(); + sync_config.background_sync_config = None; // Setup three nodes: service, client, and payer let channel_opening_fee_ppm = 10_000; From 40c4b099efffcce9dc8181f4d75f9106480c9893 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Thu, 29 Jan 2026 11:21:23 +0100 Subject: [PATCH 2/2] Bump default wallet syncing timeouts It seems that users often hit these timeouts when running in production, especially when run in sub-optimal network condidtions. Here we considerably bump the timeouts, in the hopes that users now normally shouldn't hit them ever. Signed-off-by: Elias Rohrer --- src/config.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/config.rs b/src/config.rs index 47493bca0..103b74657 100644 --- a/src/config.rs +++ b/src/config.rs @@ -30,16 +30,16 @@ const DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER: u64 = 3; const DEFAULT_ANCHOR_PER_CHANNEL_RESERVE_SATS: u64 = 25_000; // The default timeout after which we abort a wallet syncing operation. -const DEFAULT_BDK_WALLET_SYNC_TIMEOUT_SECS: u64 = 20; +const DEFAULT_BDK_WALLET_SYNC_TIMEOUT_SECS: u64 = 60; // The default timeout after which we abort a wallet syncing operation. -const DEFAULT_LDK_WALLET_SYNC_TIMEOUT_SECS: u64 = 10; +const DEFAULT_LDK_WALLET_SYNC_TIMEOUT_SECS: u64 = 30; // The default timeout after which we abort a fee rate cache update operation. -pub(crate) const DEFAULT_FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS: u64 = 5; +pub(crate) const DEFAULT_FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS: u64 = 10; // The default timeout after which we abort a transaction broadcast operation. -pub(crate) const DEFAULT_TX_BROADCAST_TIMEOUT_SECS: u64 = 5; +pub(crate) const DEFAULT_TX_BROADCAST_TIMEOUT_SECS: u64 = 10; // The default {Esplora,Electrum} client timeout we're using. const DEFAULT_PER_REQUEST_TIMEOUT_SECS: u8 = 10; @@ -387,10 +387,10 @@ impl Default for BackgroundSyncConfig { /// /// | Parameter | Value | /// |----------------------------------------|--------------------| -/// | `onchain_wallet_sync_timeout_secs` | 20 | -/// | `lightning_wallet_sync_timeout_secs` | 10 | -/// | `fee_rate_cache_update_timeout_secs` | 5 | -/// | `tx_broadcast_timeout_secs` | 5 | +/// | `onchain_wallet_sync_timeout_secs` | 60 | +/// | `lightning_wallet_sync_timeout_secs` | 30 | +/// | `fee_rate_cache_update_timeout_secs` | 10 | +/// | `tx_broadcast_timeout_secs` | 10 | /// | `per_request_timeout_secs` | 10 | #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub struct SyncTimeoutsConfig {