From 2f8c8abb6b8b6b6de5ab6def07bd1ce516a88ed8 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Wed, 25 Mar 2026 12:04:36 +0100 Subject: [PATCH] fix: expose min_funding_satoshis via Config Add `min_funding_sats` field to `Config` that maps to LDK's `ChannelHandshakeLimits::min_funding_satoshis`. This allows server operators to enforce a higher minimum channel funding amount for inbound channels, overriding the default of 1000 sats. Fixes #842 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/config.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/config.rs b/src/config.rs index 71e4d2314..ffd9d1341 100644 --- a/src/config.rs +++ b/src/config.rs @@ -125,6 +125,7 @@ pub(crate) const LNURL_AUTH_TIMEOUT_SECS: u64 = 15; /// | `node_alias` | None | /// | `trusted_peers_0conf` | [] | /// | `probing_liquidity_limit_multiplier` | 3 | +/// | `min_funding_sats` | None | /// | `anchor_channels_config` | Some(..) | /// | `route_parameters` | None | /// | `tor_config` | None | @@ -167,6 +168,17 @@ pub struct Config { /// Channels with available liquidity less than the required amount times this value won't be /// used to send pre-flight probes. pub probing_liquidity_limit_multiplier: u64, + /// The minimum funding amount in satoshis that we require from channel counterparties when + /// they open inbound channels to us. + /// + /// Channels with funding below this value will be rejected. + /// + /// If unset, the `rust-lightning` default of `1000` sats will be used. + /// + /// Please refer to [`ChannelHandshakeLimits::min_funding_satoshis`] for further details. + /// + /// [`ChannelHandshakeLimits::min_funding_satoshis`]: lightning::util::config::ChannelHandshakeLimits::min_funding_satoshis + pub min_funding_sats: Option, /// Configuration options pertaining to Anchor channels, i.e., channels for which the /// `option_anchors_zero_fee_htlc_tx` channel type is negotiated. /// @@ -210,6 +222,7 @@ impl Default for Config { announcement_addresses: None, trusted_peers_0conf: Vec::new(), probing_liquidity_limit_multiplier: DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER, + min_funding_sats: None, anchor_channels_config: Some(AnchorChannelsConfig::default()), tor_config: None, route_parameters: None, @@ -339,6 +352,9 @@ pub(crate) fn default_user_config(config: &Config) -> UserConfig { // will mostly be relevant for inbound channels. let mut user_config = UserConfig::default(); user_config.channel_handshake_limits.force_announced_channel_preference = false; + if let Some(min_funding_sats) = config.min_funding_sats { + user_config.channel_handshake_limits.min_funding_satoshis = min_funding_sats; + } user_config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = config.anchor_channels_config.is_some(); user_config.reject_inbound_splices = false;