@@ -282,7 +282,15 @@ pub(crate) fn default_user_config(config: &Config) -> UserConfig {
282282 user_config
283283}
284284
285- /// Options related to background syncing the Lightning and on-chain wallets via an Esplora backend.
285+ /// Options related to background syncing the Lightning and on-chain wallets.
286+ ///
287+ /// ### Defaults
288+ ///
289+ /// | Parameter | Value |
290+ /// |----------------------------------------|--------------------|
291+ /// | `onchain_wallet_sync_interval_secs` | 80 |
292+ /// | `lightning_wallet_sync_interval_secs` | 30 |
293+ /// | `fee_rate_cache_update_interval_secs` | 600 |
286294#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
287295pub struct BackgroundSyncConfig {
288296 /// The time in-between background sync attempts of the onchain wallet, in seconds.
@@ -301,33 +309,33 @@ pub struct BackgroundSyncConfig {
301309 pub fee_rate_cache_update_interval_secs : u64 ,
302310}
303311
312+ impl Default for BackgroundSyncConfig {
313+ fn default ( ) -> Self {
314+ Self {
315+ onchain_wallet_sync_interval_secs : DEFAULT_BDK_WALLET_SYNC_INTERVAL_SECS ,
316+ lightning_wallet_sync_interval_secs : DEFAULT_LDK_WALLET_SYNC_INTERVAL_SECS ,
317+ fee_rate_cache_update_interval_secs : DEFAULT_FEE_RATE_CACHE_UPDATE_INTERVAL_SECS ,
318+ }
319+ }
320+ }
321+
304322/// Configuration for syncing with an Esplora backend.
305323///
306- /// ### Defaults
307- ///
308- /// By default, background syncing is enabled with the following intervals:
309- ///
310- /// | Parameter | Value |
311- /// |----------------------------------------|--------------------|
312- /// | `onchain_wallet_sync_interval_secs` | 80 |
313- /// | `lightning_wallet_sync_interval_secs` | 30 |
314- /// | `fee_rate_cache_update_interval_secs` | 600 |
324+ /// Background syncing is enabled by default, using the default values specified in
325+ /// `BackgroundSyncConfig`.
315326#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
316327pub struct EsploraSyncConfig {
317328 /// Background sync configuration. If set to `None`, background syncing will be disabled.
318- /// Users will need to manually sync via [`crate::Node::sync_wallets`] for the wallets and fee rate updates.
329+ ///
330+ /// Users will need to manually sync via `Node::sync_wallets` for the wallets and fee rate updates.
331+ ///
332+ /// [`Node::sync_wallets`]: crate::Node::sync_wallets
319333 pub background_sync_config : Option < BackgroundSyncConfig > ,
320334}
321335
322336impl Default for EsploraSyncConfig {
323337 fn default ( ) -> Self {
324- Self {
325- background_sync_config : Some ( BackgroundSyncConfig {
326- onchain_wallet_sync_interval_secs : DEFAULT_BDK_WALLET_SYNC_INTERVAL_SECS ,
327- lightning_wallet_sync_interval_secs : DEFAULT_LDK_WALLET_SYNC_INTERVAL_SECS ,
328- fee_rate_cache_update_interval_secs : DEFAULT_FEE_RATE_CACHE_UPDATE_INTERVAL_SECS ,
329- } ) ,
330- }
338+ Self { background_sync_config : Some ( BackgroundSyncConfig :: default ( ) ) }
331339 }
332340}
333341
0 commit comments