Skip to content

Commit 2f8c8ab

Browse files
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) <noreply@anthropic.com>
1 parent 63c7f9b commit 2f8c8ab

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/config.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ pub(crate) const LNURL_AUTH_TIMEOUT_SECS: u64 = 15;
125125
/// | `node_alias` | None |
126126
/// | `trusted_peers_0conf` | [] |
127127
/// | `probing_liquidity_limit_multiplier` | 3 |
128+
/// | `min_funding_sats` | None |
128129
/// | `anchor_channels_config` | Some(..) |
129130
/// | `route_parameters` | None |
130131
/// | `tor_config` | None |
@@ -167,6 +168,17 @@ pub struct Config {
167168
/// Channels with available liquidity less than the required amount times this value won't be
168169
/// used to send pre-flight probes.
169170
pub probing_liquidity_limit_multiplier: u64,
171+
/// The minimum funding amount in satoshis that we require from channel counterparties when
172+
/// they open inbound channels to us.
173+
///
174+
/// Channels with funding below this value will be rejected.
175+
///
176+
/// If unset, the `rust-lightning` default of `1000` sats will be used.
177+
///
178+
/// Please refer to [`ChannelHandshakeLimits::min_funding_satoshis`] for further details.
179+
///
180+
/// [`ChannelHandshakeLimits::min_funding_satoshis`]: lightning::util::config::ChannelHandshakeLimits::min_funding_satoshis
181+
pub min_funding_sats: Option<u64>,
170182
/// Configuration options pertaining to Anchor channels, i.e., channels for which the
171183
/// `option_anchors_zero_fee_htlc_tx` channel type is negotiated.
172184
///
@@ -210,6 +222,7 @@ impl Default for Config {
210222
announcement_addresses: None,
211223
trusted_peers_0conf: Vec::new(),
212224
probing_liquidity_limit_multiplier: DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER,
225+
min_funding_sats: None,
213226
anchor_channels_config: Some(AnchorChannelsConfig::default()),
214227
tor_config: None,
215228
route_parameters: None,
@@ -339,6 +352,9 @@ pub(crate) fn default_user_config(config: &Config) -> UserConfig {
339352
// will mostly be relevant for inbound channels.
340353
let mut user_config = UserConfig::default();
341354
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+
}
342358
user_config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx =
343359
config.anchor_channels_config.is_some();
344360
user_config.reject_inbound_splices = false;

0 commit comments

Comments
 (0)