@@ -28,6 +28,7 @@ const DEFAULT_LDK_WALLET_SYNC_INTERVAL_SECS: u64 = 30;
2828const DEFAULT_FEE_RATE_CACHE_UPDATE_INTERVAL_SECS : u64 = 60 * 10 ;
2929const DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER : u64 = 3 ;
3030const DEFAULT_ANCHOR_PER_CHANNEL_RESERVE_SATS : u64 = 25_000 ;
31+ const DEFAULT_MIN_FUNDING_SATS : u64 = 1_000 ;
3132
3233// The default timeout after which we abort a wallet syncing operation.
3334const DEFAULT_BDK_WALLET_SYNC_TIMEOUT_SECS : u64 = 60 ;
@@ -125,7 +126,7 @@ pub(crate) const LNURL_AUTH_TIMEOUT_SECS: u64 = 15;
125126/// | `node_alias` | None |
126127/// | `trusted_peers_0conf` | [] |
127128/// | `probing_liquidity_limit_multiplier` | 3 |
128- /// | `min_funding_sats` | None |
129+ /// | `min_funding_sats` | 1000 |
129130/// | `anchor_channels_config` | Some(..) |
130131/// | `route_parameters` | None |
131132/// | `tor_config` | None |
@@ -173,12 +174,10 @@ pub struct Config {
173174 ///
174175 /// Channels with funding below this value will be rejected.
175176 ///
176- /// If unset, the `rust-lightning` default of `1000` sats will be used.
177- ///
178177 /// Please refer to [`ChannelHandshakeLimits::min_funding_satoshis`] for further details.
179178 ///
180179 /// [`ChannelHandshakeLimits::min_funding_satoshis`]: lightning::util::config::ChannelHandshakeLimits::min_funding_satoshis
181- pub min_funding_sats : Option < u64 > ,
180+ pub min_funding_sats : u64 ,
182181 /// Configuration options pertaining to Anchor channels, i.e., channels for which the
183182 /// `option_anchors_zero_fee_htlc_tx` channel type is negotiated.
184183 ///
@@ -222,7 +221,7 @@ impl Default for Config {
222221 announcement_addresses : None ,
223222 trusted_peers_0conf : Vec :: new ( ) ,
224223 probing_liquidity_limit_multiplier : DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER ,
225- min_funding_sats : None ,
224+ min_funding_sats : DEFAULT_MIN_FUNDING_SATS ,
226225 anchor_channels_config : Some ( AnchorChannelsConfig :: default ( ) ) ,
227226 tor_config : None ,
228227 route_parameters : None ,
@@ -352,9 +351,7 @@ pub(crate) fn default_user_config(config: &Config) -> UserConfig {
352351 // will mostly be relevant for inbound channels.
353352 let mut user_config = UserConfig :: default ( ) ;
354353 user_config. channel_handshake_limits . force_announced_channel_preference = false ;
355- if let Some ( min_funding_sats) = config. min_funding_sats {
356- user_config. channel_handshake_limits . min_funding_satoshis = min_funding_sats;
357- }
354+ user_config. channel_handshake_limits . min_funding_satoshis = config. min_funding_sats ;
358355 user_config. channel_handshake_config . negotiate_anchors_zero_fee_htlc_tx =
359356 config. anchor_channels_config . is_some ( ) ;
360357 user_config. reject_inbound_splices = false ;
@@ -653,7 +650,9 @@ pub enum AsyncPaymentsRole {
653650mod tests {
654651 use std:: str:: FromStr ;
655652
656- use super :: { may_announce_channel, AnnounceError , Config , NodeAlias , SocketAddress } ;
653+ use super :: {
654+ default_user_config, may_announce_channel, AnnounceError , Config , NodeAlias , SocketAddress ,
655+ } ;
657656
658657 #[ test]
659658 fn node_announce_channel ( ) {
@@ -700,4 +699,18 @@ mod tests {
700699 }
701700 assert ! ( may_announce_channel( & node_config) . is_ok( ) ) ;
702701 }
702+
703+ #[ test]
704+ fn min_funding_sats_configures_user_config ( ) {
705+ let mut node_config = Config :: default ( ) ;
706+ let user_config = default_user_config ( & node_config) ;
707+ assert_eq ! (
708+ user_config. channel_handshake_limits. min_funding_satoshis,
709+ node_config. min_funding_sats
710+ ) ;
711+
712+ node_config. min_funding_sats = 42_000 ;
713+ let user_config = default_user_config ( & node_config) ;
714+ assert_eq ! ( user_config. channel_handshake_limits. min_funding_satoshis, 42_000 ) ;
715+ }
703716}
0 commit comments