@@ -29,6 +29,9 @@ const DEFAULT_LDK_WALLET_SYNC_INTERVAL_SECS: u64 = 30;
2929const DEFAULT_FEE_RATE_CACHE_UPDATE_INTERVAL_SECS : u64 = 60 * 10 ;
3030const DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER : u64 = 3 ;
3131const DEFAULT_ANCHOR_PER_CHANNEL_RESERVE_SATS : u64 = 25_000 ;
32+ const DEFAULT_MIN_REBROADCAST_INTERVAL_SECS : u64 = 300 ;
33+ const DEFAULT_MAX_BROADCAST_ATTEMPTS : u32 = 24 ;
34+ const DEFAULT_BACKOFF_FACTOR : f32 = 1.5 ;
3235
3336/// The default log level.
3437pub const DEFAULT_LOG_LEVEL : LogLevel = LogLevel :: Debug ;
@@ -94,6 +97,9 @@ pub(crate) const RGS_SYNC_TIMEOUT_SECS: u64 = 5;
9497/// The length in bytes of our wallets' keys seed.
9598pub const WALLET_KEYS_SEED_LEN : usize = 64 ;
9699
100+ // The time in-between unconfirmed transaction broadcasts.
101+ pub ( crate ) const UNCONFIRMED_TX_BROADCAST_INTERVAL : Duration = Duration :: from_secs ( 300 ) ;
102+
97103#[ derive( Debug , Clone ) ]
98104/// Represents the configuration of an [`Node`] instance.
99105///
@@ -115,6 +121,7 @@ pub const WALLET_KEYS_SEED_LEN: usize = 64;
115121/// | `log_level` | Debug |
116122/// | `anchor_channels_config` | Some(..) |
117123/// | `sending_parameters` | None |
124+ /// | `auto_rebroadcast_unconfirmed_tx` | true |
118125///
119126/// See [`AnchorChannelsConfig`] and [`SendingParameters`] for more information regarding their
120127/// respective default values.
@@ -179,6 +186,16 @@ pub struct Config {
179186 /// **Note:** If unset, default parameters will be used, and you will be able to override the
180187 /// parameters on a per-payment basis in the corresponding method calls.
181188 pub sending_parameters : Option < SendingParameters > ,
189+ /// This will determine whether to automatically rebroadcast unconfirmed transactions
190+ /// (e.g., channel funding or sweep transactions).
191+ ///
192+ /// If enabled, the node will periodically attempt to rebroadcast any unconfirmed transactions to
193+ /// increase propagation and confirmation likelihood. This is helpful in cases where transactions
194+ /// were dropped by the mempool or not widely propagated.
195+ ///
196+ /// Defaults to `true`. Disabling this may be desired for privacy-sensitive use cases or low-bandwidth
197+ /// environments, but may result in slower or failed confirmations if transactions are not re-announced.
198+ pub auto_rebroadcast_unconfirmed_tx : bool ,
182199}
183200
184201impl Default for Config {
@@ -193,6 +210,7 @@ impl Default for Config {
193210 anchor_channels_config : Some ( AnchorChannelsConfig :: default ( ) ) ,
194211 sending_parameters : None ,
195212 node_alias : None ,
213+ auto_rebroadcast_unconfirmed_tx : true ,
196214 }
197215 }
198216}
@@ -534,6 +552,49 @@ impl From<MaxDustHTLCExposure> for LdkMaxDustHTLCExposure {
534552 }
535553}
536554
555+ /// Policy for controlling transaction rebroadcasting behavior.
556+ ///
557+ /// Determines the strategy for resending unconfirmed transactions to the network
558+ /// to ensure they remain in mempools and eventually get confirmed.
559+ #[ derive( Clone , Debug ) ]
560+ pub struct RebroadcastPolicy {
561+ /// Minimum time between rebroadcast attempts in seconds.
562+ ///
563+ /// This prevents excessive network traffic by ensuring a minimum delay
564+ /// between consecutive rebroadcast attempts.
565+ ///
566+ /// **Recommended values**: 60-600 seconds (1-10 minutes)
567+ pub min_rebroadcast_interval_secs : u64 ,
568+ /// Maximum number of broadcast attempts before giving up.
569+ ///
570+ /// After reaching this limit, the transaction will no longer be rebroadcast
571+ /// automatically. Manual intervention may be required.
572+ ///
573+ /// **Recommended values**: 12-48 attempts
574+ pub max_broadcast_attempts : u32 ,
575+ /// Exponential backoff factor for increasing intervals between attempts.
576+ ///
577+ /// Each subsequent rebroadcast wait time is multiplied by this factor,
578+ /// creating an exponential backoff pattern.
579+ ///
580+ /// - `1.0`: No backoff (constant interval)
581+ /// - `1.5`: 50% increase each attempt
582+ /// - `2.0`: 100% increase (doubling) each attempt
583+ ///
584+ /// **Recommended values**: 1.2-2.0
585+ pub backoff_factor : f32 ,
586+ }
587+
588+ impl Default for RebroadcastPolicy {
589+ fn default ( ) -> Self {
590+ Self {
591+ min_rebroadcast_interval_secs : DEFAULT_MIN_REBROADCAST_INTERVAL_SECS ,
592+ max_broadcast_attempts : DEFAULT_MAX_BROADCAST_ATTEMPTS ,
593+ backoff_factor : DEFAULT_BACKOFF_FACTOR ,
594+ }
595+ }
596+ }
597+
537598#[ cfg( test) ]
538599mod tests {
539600 use std:: str:: FromStr ;
0 commit comments