Skip to content

Commit 779b194

Browse files
committed
Set default ChannelHandshakeLimits::min_funding_satoshis to 1000
The original default value of 0 was inconsistent with the minimum requirement of 1000 satoshis in ChannelHandshakeConfig::their_channel_reserve_proportional_millionths.
1 parent 1d9d911 commit 779b194

File tree

1 file changed

+16
-26
lines changed

1 file changed

+16
-26
lines changed

lightning/src/util/config.rs

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ pub struct ChannelHandshakeConfig {
6767
///
6868
/// Note that:
6969
/// * If configured to another value than the default value `10`, any new channels created with
70-
/// the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
71-
/// `ChannelManager`.
70+
/// the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
71+
/// `ChannelManager`.
7272
///
7373
/// * This caps the total value for inbound HTLCs in-flight only, and there's currently
74-
/// no way to configure the cap for the total value of outbound HTLCs in-flight.
74+
/// no way to configure the cap for the total value of outbound HTLCs in-flight.
7575
///
7676
/// * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
77-
/// are different from the non-HTLC-encumbered funds. This makes this an important knob to
78-
/// restrict exposure to loss due to being offline for too long.
79-
/// See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
80-
/// for more information.
77+
/// are different from the non-HTLC-encumbered funds. This makes this an important knob to
78+
/// restrict exposure to loss due to being offline for too long.
79+
/// See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
80+
/// for more information.
8181
///
8282
/// Default value: `10`
8383
///
@@ -257,7 +257,8 @@ pub struct ChannelHandshakeLimits {
257257
/// Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
258258
/// only applies to inbound channels.
259259
///
260-
/// Default value: `0`
260+
/// Default value: `1000`
261+
/// (Minimum of [`ChannelHandshakeConfig::their_channel_reserve_proportional_millionths`])
261262
pub min_funding_satoshis: u64,
262263
/// Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
263264
/// only applies to inbound channels.
@@ -332,11 +333,11 @@ pub struct ChannelHandshakeLimits {
332333
impl Default for ChannelHandshakeLimits {
333334
fn default() -> Self {
334335
ChannelHandshakeLimits {
335-
min_funding_satoshis: 0,
336+
min_funding_satoshis: 1000,
336337
max_funding_satoshis: MAX_FUNDING_SATOSHIS_NO_WUMBO,
337-
max_htlc_minimum_msat: <u64>::max_value(),
338+
max_htlc_minimum_msat: u64::MAX,
338339
min_max_htlc_value_in_flight_msat: 0,
339-
max_channel_reserve_satoshis: <u64>::max_value(),
340+
max_channel_reserve_satoshis: u64::MAX,
340341
min_max_accepted_htlcs: 0,
341342
trust_own_funding_0conf: true,
342343
max_minimum_depth: 144,
@@ -388,10 +389,10 @@ pub enum MaxDustHTLCExposure {
388389
/// `FeeRateMultiplier(10_000)`:
389390
///
390391
/// - For the minimum fee rate of 1 sat/vByte (250 sat/KW, although the minimum
391-
/// defaults to 253 sats/KW for rounding, see [`FeeEstimator`]), the max dust exposure would
392-
/// be 253 * 10_000 = 2,530,000 msats.
392+
/// defaults to 253 sats/KW for rounding, see [`FeeEstimator`]), the max dust exposure would
393+
/// be 253 * 10_000 = 2,530,000 msats.
393394
/// - For a fee rate of 30 sat/vByte (7500 sat/KW), the max dust exposure would be
394-
/// 7500 * 50_000 = 75,000,000 msats (0.00075 BTC).
395+
/// 7500 * 50_000 = 75,000,000 msats (0.00075 BTC).
395396
///
396397
/// Note, if you're using a third-party fee estimator, this may leave you more exposed to a
397398
/// fee griefing attack, where your fee estimator may purposely overestimate the fee rate,
@@ -670,6 +671,7 @@ impl crate::util::ser::Readable for ChannelConfig {
670671

671672
/// A parallel struct to [`ChannelConfig`] to define partial updates.
672673
#[allow(missing_docs)]
674+
#[derive(Default)]
673675
pub struct ChannelConfigUpdate {
674676
pub forwarding_fee_proportional_millionths: Option<u32>,
675677
pub forwarding_fee_base_msat: Option<u32>,
@@ -678,18 +680,6 @@ pub struct ChannelConfigUpdate {
678680
pub force_close_avoidance_max_fee_satoshis: Option<u64>,
679681
}
680682

681-
impl Default for ChannelConfigUpdate {
682-
fn default() -> ChannelConfigUpdate {
683-
ChannelConfigUpdate {
684-
forwarding_fee_proportional_millionths: None,
685-
forwarding_fee_base_msat: None,
686-
cltv_expiry_delta: None,
687-
max_dust_htlc_exposure_msat: None,
688-
force_close_avoidance_max_fee_satoshis: None,
689-
}
690-
}
691-
}
692-
693683
impl From<ChannelConfig> for ChannelConfigUpdate {
694684
fn from(config: ChannelConfig) -> ChannelConfigUpdate {
695685
ChannelConfigUpdate {

0 commit comments

Comments
 (0)