Skip to content

Commit cfc7ec6

Browse files
committed
Add max dust exposure multiplier config knob
With fee rates rising dramatically in mid-April 2023, thresholds for what is considered dust have risen, often exceeding our previous dust exposure threshold of 5k sats. This causes all payments and HTLC forwards between 5k sats and new dust thresholds to fail. This commit changes our max dust exposure config knob from a fixed upper limit to a `MaxDustHTLCExposure` enum with an additional variant to allow setting our max dust exposure to a multiplier on the current high priority feerate. To remain backwards compatible we'll always write the fixed limit if it's set, or its default value in its currently reserved TLV. We also now write an odd TLV for the new enum, so that previous versions can safely ignore it upon downgrading, while allowing us to make use of the new type when it's written.
1 parent 89aa7ac commit cfc7ec6

File tree

6 files changed

+151
-42
lines changed

6 files changed

+151
-42
lines changed

lightning/src/ln/channel.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use crate::routing::gossip::NodeId;
4141
use crate::util::ser::{Readable, ReadableArgs, Writeable, Writer, VecWriter};
4242
use crate::util::logger::Logger;
4343
use crate::util::errors::APIError;
44-
use crate::util::config::{UserConfig, ChannelConfig, LegacyChannelConfig, ChannelHandshakeConfig, ChannelHandshakeLimits};
44+
use crate::util::config::{UserConfig, ChannelConfig, LegacyChannelConfig, ChannelHandshakeConfig, ChannelHandshakeLimits, MaxDustHTLCExposure};
4545
use crate::util::scid_utils::scid_from_parts;
4646

4747
use crate::io;
@@ -1060,7 +1060,10 @@ impl<Signer: ChannelSigner> ChannelContext<Signer> {
10601060
}
10611061

10621062
pub fn get_max_dust_htlc_exposure_msat(&self) -> u64 {
1063-
self.config.options.max_dust_htlc_exposure_msat
1063+
match self.config.options.max_dust_htlc_exposure {
1064+
MaxDustHTLCExposure::FixedLimitMsat(limit) => limit,
1065+
MaxDustHTLCExposure::FeeRateMultiplier(_) => 5_000_000,
1066+
}
10641067
}
10651068

10661069
/// Returns the previous [`ChannelConfig`] applied to this channel, if any.

lightning/src/ln/functional_test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::util::scid_utils;
2727
use crate::util::test_utils;
2828
use crate::util::test_utils::{panicking, TestChainMonitor, TestScorer, TestKeysInterface};
2929
use crate::util::errors::APIError;
30-
use crate::util::config::UserConfig;
30+
use crate::util::config::{UserConfig, MaxDustHTLCExposure};
3131
use crate::util::ser::{ReadableArgs, Writeable};
3232

3333
use bitcoin::blockdata::block::{Block, BlockHeader};
@@ -2573,7 +2573,7 @@ pub fn test_default_channel_config() -> UserConfig {
25732573
default_config.channel_handshake_config.our_htlc_minimum_msat = 1000;
25742574
// When most of our tests were written, we didn't have the notion of a `max_dust_htlc_exposure_msat`,
25752575
// It now defaults to 5_000_000 msat; to avoid interfering with tests we bump it to 50_000_000 msat.
2576-
default_config.channel_config.max_dust_htlc_exposure_msat = 50_000_000;
2576+
default_config.channel_config.max_dust_htlc_exposure = MaxDustHTLCExposure::FixedLimitMsat(50_000_000);
25772577
default_config
25782578
}
25792579

lightning/src/ln/functional_tests.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::util::test_utils;
3535
use crate::util::errors::APIError;
3636
use crate::util::ser::{Writeable, ReadableArgs};
3737
use crate::util::string::UntrustedString;
38-
use crate::util::config::UserConfig;
38+
use crate::util::config::{UserConfig, MaxDustHTLCExposure};
3939

4040
use bitcoin::hash_types::BlockHash;
4141
use bitcoin::blockdata::script::{Builder, Script};
@@ -9530,7 +9530,7 @@ fn do_test_max_dust_htlc_exposure(dust_outbound_balance: bool, exposure_breach_e
95309530

95319531
let chanmon_cfgs = create_chanmon_cfgs(2);
95329532
let mut config = test_default_channel_config();
9533-
config.channel_config.max_dust_htlc_exposure_msat = 5_000_000; // default setting value
9533+
config.channel_config.max_dust_htlc_exposure = MaxDustHTLCExposure::FixedLimitMsat(5_000_000); // default setting value
95349534
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
95359535
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(config), None]);
95369536
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
@@ -9574,20 +9574,21 @@ fn do_test_max_dust_htlc_exposure(dust_outbound_balance: bool, exposure_breach_e
95749574
let (mut route, payment_hash, _, payment_secret) =
95759575
get_route_and_payment_hash!(nodes[0], nodes[1], 1000);
95769576

9577-
let dust_buffer_feerate = {
9577+
let (dust_buffer_feerate, max_dust_htlc_exposure_msat) = {
95789578
let per_peer_state = nodes[0].node.per_peer_state.read().unwrap();
95799579
let chan_lock = per_peer_state.get(&nodes[1].node.get_our_node_id()).unwrap().lock().unwrap();
95809580
let chan = chan_lock.channel_by_id.get(&channel_id).unwrap();
9581-
chan.context.get_dust_buffer_feerate(None) as u64
9581+
(chan.context.get_dust_buffer_feerate(None) as u64,
9582+
chan.context.get_max_dust_htlc_exposure_msat())
95829583
};
95839584
let dust_outbound_htlc_on_holder_tx_msat: u64 = (dust_buffer_feerate * htlc_timeout_tx_weight(&channel_type_features) / 1000 + open_channel.dust_limit_satoshis - 1) * 1000;
9584-
let dust_outbound_htlc_on_holder_tx: u64 = config.channel_config.max_dust_htlc_exposure_msat / dust_outbound_htlc_on_holder_tx_msat;
9585+
let dust_outbound_htlc_on_holder_tx: u64 = max_dust_htlc_exposure_msat / dust_outbound_htlc_on_holder_tx_msat;
95859586

95869587
let dust_inbound_htlc_on_holder_tx_msat: u64 = (dust_buffer_feerate * htlc_success_tx_weight(&channel_type_features) / 1000 + open_channel.dust_limit_satoshis - 1) * 1000;
9587-
let dust_inbound_htlc_on_holder_tx: u64 = config.channel_config.max_dust_htlc_exposure_msat / dust_inbound_htlc_on_holder_tx_msat;
9588+
let dust_inbound_htlc_on_holder_tx: u64 = max_dust_htlc_exposure_msat / dust_inbound_htlc_on_holder_tx_msat;
95889589

95899590
let dust_htlc_on_counterparty_tx: u64 = 4;
9590-
let dust_htlc_on_counterparty_tx_msat: u64 = config.channel_config.max_dust_htlc_exposure_msat / dust_htlc_on_counterparty_tx;
9591+
let dust_htlc_on_counterparty_tx_msat: u64 = max_dust_htlc_exposure_msat / dust_htlc_on_counterparty_tx;
95919592

95929593
if on_holder_tx {
95939594
if dust_outbound_balance {
@@ -9652,13 +9653,13 @@ fn do_test_max_dust_htlc_exposure(dust_outbound_balance: bool, exposure_breach_e
96529653
// Outbound dust balance: 6399 sats
96539654
let dust_inbound_overflow = dust_inbound_htlc_on_holder_tx_msat * (dust_inbound_htlc_on_holder_tx + 1);
96549655
let dust_outbound_overflow = dust_outbound_htlc_on_holder_tx_msat * dust_outbound_htlc_on_holder_tx + dust_inbound_htlc_on_holder_tx_msat;
9655-
nodes[0].logger.assert_log("lightning::ln::channel".to_string(), format!("Cannot accept value that would put our exposure to dust HTLCs at {} over the limit {} on holder commitment tx", if dust_outbound_balance { dust_outbound_overflow } else { dust_inbound_overflow }, config.channel_config.max_dust_htlc_exposure_msat), 1);
9656+
nodes[0].logger.assert_log("lightning::ln::channel".to_string(), format!("Cannot accept value that would put our exposure to dust HTLCs at {} over the limit {} on holder commitment tx", if dust_outbound_balance { dust_outbound_overflow } else { dust_inbound_overflow }, max_dust_htlc_exposure_msat), 1);
96569657
} else {
96579658
// Outbound dust balance: 5200 sats
96589659
nodes[0].logger.assert_log("lightning::ln::channel".to_string(),
96599660
format!("Cannot accept value that would put our exposure to dust HTLCs at {} over the limit {} on counterparty commitment tx",
96609661
dust_htlc_on_counterparty_tx_msat * (dust_htlc_on_counterparty_tx - 1) + dust_htlc_on_counterparty_tx_msat + 1,
9661-
config.channel_config.max_dust_htlc_exposure_msat), 1);
9662+
max_dust_htlc_exposure_msat), 1);
96629663
}
96639664
} else if exposure_breach_event == ExposureEvent::AtUpdateFeeOutbound {
96649665
route.paths[0].hops.last_mut().unwrap().fee_msat = 2_500_000;

lightning/src/ln/onion_route_tests.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use crate::ln::msgs::{ChannelMessageHandler, ChannelUpdate};
2626
use crate::ln::wire::Encode;
2727
use crate::util::ser::{Writeable, Writer};
2828
use crate::util::test_utils;
29-
use crate::util::config::{UserConfig, ChannelConfig};
29+
use crate::util::config::{UserConfig, ChannelConfig, MaxDustHTLCExposure};
3030
use crate::util::errors::APIError;
3131

3232
use bitcoin::hash_types::BlockHash;
@@ -1374,7 +1374,8 @@ fn test_phantom_dust_exposure_failure() {
13741374
// Set the max dust exposure to the dust limit.
13751375
let max_dust_exposure = 546;
13761376
let mut receiver_config = UserConfig::default();
1377-
receiver_config.channel_config.max_dust_htlc_exposure_msat = max_dust_exposure;
1377+
receiver_config.channel_config.max_dust_htlc_exposure =
1378+
MaxDustHTLCExposure::FixedLimitMsat(max_dust_exposure);
13781379
receiver_config.channel_handshake_config.announced_channel = true;
13791380

13801381
let chanmon_cfgs = create_chanmon_cfgs(2);

lightning/src/util/config.rs

Lines changed: 130 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,55 @@ impl Default for ChannelHandshakeLimits {
315315
}
316316
}
317317

318+
/// Options for how to set the max dust HTLC exposure allowed on a channel. See
319+
/// [`ChannelConfig::max_dust_htlc_exposure`] for details.
320+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
321+
pub enum MaxDustHTLCExposure {
322+
/// This sets a fixed limit on the total dust exposure in millisatoshis. Setting this too low
323+
/// may prevent the sending or receipt of low-value HTLCs on high-traffic nodes, however this
324+
/// limit is very important to prevent stealing of large amounts of dust HTLCs by miners
325+
/// through [fee griefing
326+
/// attacks](https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-May/002714.html).
327+
///
328+
/// Note that if the feerate increases significantly, without a manual increase
329+
/// to this maximum the channel may be unable to send/receive HTLCs between the maximum dust
330+
/// exposure and the new minimum value for HTLCs to be economically viable to claim.
331+
FixedLimitMsat(u64),
332+
/// This sets a multiplier on the estimated high priority feerate (sats/KW, as obtained from
333+
/// [`FeeEstimator`]) to determine the maximum allowed dust exposure. If this variant is used
334+
/// then the maximum dust exposure in millisatoshis is calculated as:
335+
/// `high_priority_feerate_per_kw * value`. For example, with our default value
336+
/// `FeeRateMultiplier(5000)`:
337+
///
338+
/// - For the minimum fee rate of 1 sat/vByte (250 sat/KW, although the minimum
339+
/// defaults to 253 sats/KW for rounding, see [`FeeEstimator`]), the max dust exposure would
340+
/// be 253 * 5000 = 1,265,000 msats.
341+
/// - For a fee rate of 30 sat/vByte (7500 sat/KW), the max dust exposure would be
342+
/// 7500 * 5000 = 37,500,000 msats.
343+
///
344+
/// This allows the maximum dust exposure to automatically scale with fee rate changes.
345+
///
346+
/// Note, if you're using a third-party fee estimator, this may leave you more exposed to a
347+
/// fee griefing attack, where your fee estimator may purposely overestimate the fee rate,
348+
/// causing you to accept more dust HTLCs than you would otherwise.
349+
///
350+
/// This variant is primarily meant to serve pre-anchor channels, as HTLC fees being included
351+
/// on HTLC outputs means your channel may be subject to more dust exposure in the event of
352+
/// increases in fee rate.
353+
///
354+
/// # Backwards Compatibility
355+
/// This variant only became available in LDK 0.0.116, so if you downgrade to a prior version
356+
/// by default this will be set to a [`Self::FixedLimitMsat`] of 5,000,000 msat.
357+
///
358+
/// [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator
359+
FeeRateMultiplier(u64),
360+
}
361+
362+
impl_writeable_tlv_based_enum!(MaxDustHTLCExposure, ;
363+
(1, FixedLimitMsat),
364+
(3, FeeRateMultiplier),
365+
);
366+
318367
/// Options which apply on a per-channel basis and may change at runtime or based on negotiation
319368
/// with our counterparty.
320369
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
@@ -372,15 +421,15 @@ pub struct ChannelConfig {
372421
/// channel negotiated throughout the channel open process, along with the fees required to have
373422
/// a broadcastable HTLC spending transaction. When a channel supports anchor outputs
374423
/// (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
375-
/// account the HTLC transaction fee as it is zero.
424+
/// account the HTLC transaction fee as it is zero. Because of this, you may want to set this
425+
/// value to a fixed limit for channels using anchor outputs, while the fee rate multiplier
426+
/// variant is primarily intended for use with pre-anchor channels.
376427
///
377-
/// This limit is applied for sent, forwarded, and received HTLCs and limits the total
378-
/// exposure across all three types per-channel. Setting this too low may prevent the
379-
/// sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
380-
/// important to prevent stealing of dust HTLCs by miners.
428+
/// The selected limit is applied for sent, forwarded, and received HTLCs and limits the total
429+
/// exposure across all three types per-channel.
381430
///
382-
/// Default value: 5_000_000 msat.
383-
pub max_dust_htlc_exposure_msat: u64,
431+
/// Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of 5000.
432+
pub max_dust_htlc_exposure: MaxDustHTLCExposure,
384433
/// The additional fee we're willing to pay to avoid waiting for the counterparty's
385434
/// `to_self_delay` to reclaim funds.
386435
///
@@ -451,7 +500,7 @@ impl ChannelConfig {
451500
self.cltv_expiry_delta = cltv_expiry_delta;
452501
}
453502
if let Some(max_dust_htlc_exposure_msat) = update.max_dust_htlc_exposure_msat {
454-
self.max_dust_htlc_exposure_msat = max_dust_htlc_exposure_msat;
503+
self.max_dust_htlc_exposure = max_dust_htlc_exposure_msat;
455504
}
456505
if let Some(force_close_avoidance_max_fee_satoshis) = update.force_close_avoidance_max_fee_satoshis {
457506
self.force_close_avoidance_max_fee_satoshis = force_close_avoidance_max_fee_satoshis;
@@ -466,32 +515,75 @@ impl Default for ChannelConfig {
466515
forwarding_fee_proportional_millionths: 0,
467516
forwarding_fee_base_msat: 1000,
468517
cltv_expiry_delta: 6 * 12, // 6 blocks/hour * 12 hours
469-
max_dust_htlc_exposure_msat: 5_000_000,
518+
max_dust_htlc_exposure: MaxDustHTLCExposure::FeeRateMultiplier(5000),
470519
force_close_avoidance_max_fee_satoshis: 1000,
471520
accept_underpaying_htlcs: false,
472521
}
473522
}
474523
}
475524

476-
impl_writeable_tlv_based!(ChannelConfig, {
477-
(0, forwarding_fee_proportional_millionths, required),
478-
(1, accept_underpaying_htlcs, (default_value, false)),
479-
(2, forwarding_fee_base_msat, required),
480-
(4, cltv_expiry_delta, required),
481-
(6, max_dust_htlc_exposure_msat, required),
482-
// ChannelConfig serialized this field with a required type of 8 prior to the introduction of
483-
// LegacyChannelConfig. To make sure that serialization is not compatible with this one, we use
484-
// the next required type of 10, which if seen by the old serialization will always fail.
485-
(10, force_close_avoidance_max_fee_satoshis, required),
486-
});
525+
impl crate::util::ser::Writeable for ChannelConfig {
526+
fn write<W: crate::util::ser::Writer>(&self, writer: &mut W) -> Result<(), crate::io::Error> {
527+
let max_dust_htlc_exposure_msat_fixed_limit = match self.max_dust_htlc_exposure {
528+
MaxDustHTLCExposure::FixedLimitMsat(limit) => limit,
529+
MaxDustHTLCExposure::FeeRateMultiplier(_) => 5_000_000,
530+
};
531+
write_tlv_fields!(writer, {
532+
(0, self.forwarding_fee_proportional_millionths, required),
533+
(1, self.accept_underpaying_htlcs, (default_value, false)),
534+
(2, self.forwarding_fee_base_msat, required),
535+
(3, self.max_dust_htlc_exposure, required),
536+
(4, self.cltv_expiry_delta, required),
537+
(6, max_dust_htlc_exposure_msat_fixed_limit, required),
538+
// ChannelConfig serialized this field with a required type of 8 prior to the introduction of
539+
// LegacyChannelConfig. To make sure that serialization is not compatible with this one, we use
540+
// the next required type of 10, which if seen by the old serialization will always fail.
541+
(10, self.force_close_avoidance_max_fee_satoshis, required),
542+
});
543+
Ok(())
544+
}
545+
}
546+
547+
impl crate::util::ser::Readable for ChannelConfig {
548+
fn read<R: crate::io::Read>(reader: &mut R) -> Result<Self, crate::ln::msgs::DecodeError> {
549+
let mut forwarding_fee_proportional_millionths = 0;
550+
let mut accept_underpaying_htlcs = false;
551+
let mut forwarding_fee_base_msat = 1000;
552+
let mut cltv_expiry_delta = 6 * 12;
553+
let mut max_dust_htlc_exposure_msat = None;
554+
let mut max_dust_htlc_exposure_enum = None;
555+
let mut force_close_avoidance_max_fee_satoshis = 1000;
556+
read_tlv_fields!(reader, {
557+
(0, forwarding_fee_proportional_millionths, required),
558+
(1, accept_underpaying_htlcs, (default_value, false)),
559+
(2, forwarding_fee_base_msat, required),
560+
(3, max_dust_htlc_exposure_enum, option),
561+
(4, cltv_expiry_delta, required),
562+
// Has always been written, but became optionally read in 0.0.116
563+
(6, max_dust_htlc_exposure_msat, option),
564+
(10, force_close_avoidance_max_fee_satoshis, required),
565+
});
566+
let max_dust_htlc_fixed_limit = max_dust_htlc_exposure_msat.unwrap_or(5_000_000);
567+
let max_dust_htlc_exposure_msat = max_dust_htlc_exposure_enum
568+
.unwrap_or(MaxDustHTLCExposure::FixedLimitMsat(max_dust_htlc_fixed_limit));
569+
Ok(Self {
570+
forwarding_fee_proportional_millionths,
571+
accept_underpaying_htlcs,
572+
forwarding_fee_base_msat,
573+
cltv_expiry_delta,
574+
max_dust_htlc_exposure: max_dust_htlc_exposure_msat,
575+
force_close_avoidance_max_fee_satoshis,
576+
})
577+
}
578+
}
487579

488580
/// A parallel struct to [`ChannelConfig`] to define partial updates.
489581
#[allow(missing_docs)]
490582
pub struct ChannelConfigUpdate {
491583
pub forwarding_fee_proportional_millionths: Option<u32>,
492584
pub forwarding_fee_base_msat: Option<u32>,
493585
pub cltv_expiry_delta: Option<u16>,
494-
pub max_dust_htlc_exposure_msat: Option<u64>,
586+
pub max_dust_htlc_exposure_msat: Option<MaxDustHTLCExposure>,
495587
pub force_close_avoidance_max_fee_satoshis: Option<u64>,
496588
}
497589

@@ -513,7 +605,7 @@ impl From<ChannelConfig> for ChannelConfigUpdate {
513605
forwarding_fee_proportional_millionths: Some(config.forwarding_fee_proportional_millionths),
514606
forwarding_fee_base_msat: Some(config.forwarding_fee_base_msat),
515607
cltv_expiry_delta: Some(config.cltv_expiry_delta),
516-
max_dust_htlc_exposure_msat: Some(config.max_dust_htlc_exposure_msat),
608+
max_dust_htlc_exposure_msat: Some(config.max_dust_htlc_exposure),
517609
force_close_avoidance_max_fee_satoshis: Some(config.force_close_avoidance_max_fee_satoshis),
518610
}
519611
}
@@ -546,12 +638,17 @@ impl Default for LegacyChannelConfig {
546638

547639
impl crate::util::ser::Writeable for LegacyChannelConfig {
548640
fn write<W: crate::util::ser::Writer>(&self, writer: &mut W) -> Result<(), crate::io::Error> {
641+
let max_dust_htlc_exposure_msat_fixed_limit = match self.options.max_dust_htlc_exposure {
642+
MaxDustHTLCExposure::FixedLimitMsat(limit) => limit,
643+
MaxDustHTLCExposure::FeeRateMultiplier(_) => 5_000_000,
644+
};
549645
write_tlv_fields!(writer, {
550646
(0, self.options.forwarding_fee_proportional_millionths, required),
551-
(1, self.options.max_dust_htlc_exposure_msat, (default_value, 5_000_000)),
647+
(1, max_dust_htlc_exposure_msat_fixed_limit, required),
552648
(2, self.options.cltv_expiry_delta, required),
553649
(3, self.options.force_close_avoidance_max_fee_satoshis, (default_value, 1000)),
554650
(4, self.announced_channel, required),
651+
(5, self.options.max_dust_htlc_exposure, required),
555652
(6, self.commit_upfront_shutdown_pubkey, required),
556653
(8, self.options.forwarding_fee_base_msat, required),
557654
});
@@ -562,25 +659,32 @@ impl crate::util::ser::Writeable for LegacyChannelConfig {
562659
impl crate::util::ser::Readable for LegacyChannelConfig {
563660
fn read<R: crate::io::Read>(reader: &mut R) -> Result<Self, crate::ln::msgs::DecodeError> {
564661
let mut forwarding_fee_proportional_millionths = 0;
565-
let mut max_dust_htlc_exposure_msat = 5_000_000;
662+
let mut max_dust_htlc_exposure_msat_fixed_limit = None;
566663
let mut cltv_expiry_delta = 0;
567664
let mut force_close_avoidance_max_fee_satoshis = 1000;
568665
let mut announced_channel = false;
569666
let mut commit_upfront_shutdown_pubkey = false;
570667
let mut forwarding_fee_base_msat = 0;
668+
let mut max_dust_htlc_exposure_enum = None;
571669
read_tlv_fields!(reader, {
572670
(0, forwarding_fee_proportional_millionths, required),
573-
(1, max_dust_htlc_exposure_msat, (default_value, 5_000_000u64)),
671+
// Has always been written, but became optionally read in 0.0.116
672+
(1, max_dust_htlc_exposure_msat_fixed_limit, option),
574673
(2, cltv_expiry_delta, required),
575674
(3, force_close_avoidance_max_fee_satoshis, (default_value, 1000u64)),
576675
(4, announced_channel, required),
676+
(5, max_dust_htlc_exposure_enum, option),
577677
(6, commit_upfront_shutdown_pubkey, required),
578678
(8, forwarding_fee_base_msat, required),
579679
});
680+
let max_dust_htlc_exposure_msat_fixed_limit =
681+
max_dust_htlc_exposure_msat_fixed_limit.unwrap_or(5_000_000);
682+
let max_dust_htlc_exposure_msat = max_dust_htlc_exposure_enum
683+
.unwrap_or(MaxDustHTLCExposure::FixedLimitMsat(max_dust_htlc_exposure_msat_fixed_limit));
580684
Ok(Self {
581685
options: ChannelConfig {
582686
forwarding_fee_proportional_millionths,
583-
max_dust_htlc_exposure_msat,
687+
max_dust_htlc_exposure: max_dust_htlc_exposure_msat,
584688
cltv_expiry_delta,
585689
force_close_avoidance_max_fee_satoshis,
586690
forwarding_fee_base_msat,

lightning/src/util/ser_macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ macro_rules! impl_writeable_tlv_based_enum {
981981
f()
982982
}),*
983983
$($tuple_variant_id => {
984-
Ok($st::$tuple_variant_name(Readable::read(reader)?))
984+
Ok($st::$tuple_variant_name($crate::util::ser::Readable::read(reader)?))
985985
}),*
986986
_ => {
987987
Err($crate::ln::msgs::DecodeError::UnknownRequiredFeature)

0 commit comments

Comments
 (0)