Expose min_funding_satoshis via Config#844
Open
vincenzopalazzo wants to merge 1 commit intolightningdevkit:mainfrom
Open
Expose min_funding_satoshis via Config#844vincenzopalazzo wants to merge 1 commit intolightningdevkit:mainfrom
vincenzopalazzo wants to merge 1 commit intolightningdevkit:mainfrom
Conversation
|
👋 Thanks for assigning @tankyleo as a reviewer! |
44bc110 to
2f8c8ab
Compare
tankyleo
reviewed
Mar 26, 2026
Contributor
There was a problem hiding this comment.
I would have cleaned it up like this; I don't think it's worth adding the Option there, the config setting logically is just a single number.
diff --git a/src/config.rs b/src/config.rs
index ffd9d134..d6402257 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -28,6 +28,7 @@ const DEFAULT_LDK_WALLET_SYNC_INTERVAL_SECS: u64 = 30;
const DEFAULT_FEE_RATE_CACHE_UPDATE_INTERVAL_SECS: u64 = 60 * 10;
const DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER: u64 = 3;
const DEFAULT_ANCHOR_PER_CHANNEL_RESERVE_SATS: u64 = 25_000;
+const DEFAULT_MIN_FUNDING_SATS: u64 = 1000;
// The default timeout after which we abort a wallet syncing operation.
const DEFAULT_BDK_WALLET_SYNC_TIMEOUT_SECS: u64 = 60;
@@ -125,7 +126,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 |
+/// | `min_funding_sats` | 1000 |
/// | `anchor_channels_config` | Some(..) |
/// | `route_parameters` | None |
/// | `tor_config` | None |
@@ -172,13 +173,7 @@ pub struct Config {
/// 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<u64>,
+ pub min_funding_sats: u64,
/// Configuration options pertaining to Anchor channels, i.e., channels for which the
/// `option_anchors_zero_fee_htlc_tx` channel type is negotiated.
///
@@ -222,7 +217,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,
+ min_funding_sats: DEFAULT_MIN_FUNDING_SATS,
anchor_channels_config: Some(AnchorChannelsConfig::default()),
tor_config: None,
route_parameters: None,
@@ -352,9 +347,7 @@ 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_limits.min_funding_satoshis = config.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;
Contributor
Author
Add `min_funding_sats` to `Config` and map it to LDK's `ChannelHandshakeLimits::min_funding_satoshis`. Use a plain `u64` with an explicit default and cover both the default and override behavior with a unit test so operators can enforce a higher minimum inbound channel funding amount. Fixes lightningdevkit#842 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> AI-assisted-by: Codex
e2113b3 to
0aad750
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
min_funding_satsfield toConfigthat maps to LDK'sChannelHandshakeLimits::min_funding_satoshisFixes #842
Test plan
cargo checkpassescargo test --lib configpassesCo-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
AI-assisted-by: OpenAI Codex
cc @tankyleo