Skip to content

Commit 44bc110

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 44bc110

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/config.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const DEFAULT_LDK_WALLET_SYNC_INTERVAL_SECS: u64 = 30;
2828
const DEFAULT_FEE_RATE_CACHE_UPDATE_INTERVAL_SECS: u64 = 60 * 10;
2929
const DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER: u64 = 3;
3030
const 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.
3334
const DEFAULT_BDK_WALLET_SYNC_TIMEOUT_SECS: u64 = 60;
@@ -125,6 +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 |
129+
/// | `min_funding_sats` | 1000 |
128130
/// | `anchor_channels_config` | Some(..) |
129131
/// | `route_parameters` | None |
130132
/// | `tor_config` | None |
@@ -167,6 +169,15 @@ pub struct Config {
167169
/// Channels with available liquidity less than the required amount times this value won't be
168170
/// used to send pre-flight probes.
169171
pub probing_liquidity_limit_multiplier: u64,
172+
/// The minimum funding amount in satoshis that we require from channel counterparties when
173+
/// they open inbound channels to us.
174+
///
175+
/// Channels with funding below this value will be rejected.
176+
///
177+
/// Please refer to [`ChannelHandshakeLimits::min_funding_satoshis`] for further details.
178+
///
179+
/// [`ChannelHandshakeLimits::min_funding_satoshis`]: lightning::util::config::ChannelHandshakeLimits::min_funding_satoshis
180+
pub min_funding_sats: u64,
170181
/// Configuration options pertaining to Anchor channels, i.e., channels for which the
171182
/// `option_anchors_zero_fee_htlc_tx` channel type is negotiated.
172183
///
@@ -210,6 +221,7 @@ impl Default for Config {
210221
announcement_addresses: None,
211222
trusted_peers_0conf: Vec::new(),
212223
probing_liquidity_limit_multiplier: DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER,
224+
min_funding_sats: DEFAULT_MIN_FUNDING_SATS,
213225
anchor_channels_config: Some(AnchorChannelsConfig::default()),
214226
tor_config: None,
215227
route_parameters: None,
@@ -339,6 +351,7 @@ pub(crate) fn default_user_config(config: &Config) -> UserConfig {
339351
// will mostly be relevant for inbound channels.
340352
let mut user_config = UserConfig::default();
341353
user_config.channel_handshake_limits.force_announced_channel_preference = false;
354+
user_config.channel_handshake_limits.min_funding_satoshis = config.min_funding_sats;
342355
user_config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx =
343356
config.anchor_channels_config.is_some();
344357
user_config.reject_inbound_splices = false;

0 commit comments

Comments
 (0)