Skip to content

Commit 6741946

Browse files
committed
f - Replace new field with enum
Instead of having a separate optional field, we replace the current value with an enum. 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 optional TLV for the new enum, so that previous versions can safely ignore it, while allowing us to make use of the new type when it's written.
1 parent 289a04b commit 6741946

File tree

6 files changed

+119
-65
lines changed

6 files changed

+119
-65
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_msat {
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_msat = 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_msat = 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_msat =
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: 98 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,34 @@ 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_msat`] 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, and this limit
324+
/// is very important to prevent stealing of dust HTLCs by miners.
325+
///
326+
/// Note that if the feerate increases significantly, without a manually increase
327+
/// to this maximum the channel may be unable to send/receive HTLCs between the maximum dust
328+
/// exposure and the new minimum value for HTLCs to be economically viable to claim.
329+
FixedLimitMsat(u64),
330+
/// This sets a multiplier on the estimated high priority feerate (sats/KW, as obtained from
331+
/// [`FeeEstimator`]) to determine the maximum allowed dust exposure. If this variant is used
332+
/// then the maximum dust exposure in millisatoshis is calculated as:
333+
/// `high_priority_feerate_per_kw * value`.
334+
///
335+
/// This allows the maximum dust exposure to automatically scale with fee rate changes.
336+
///
337+
/// [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator
338+
FeeRateMultiplier(u64),
339+
}
340+
341+
impl_writeable_tlv_based_enum!(MaxDustHTLCExposure, ;
342+
(1, FixedLimitMsat),
343+
(3, FeeRateMultiplier),
344+
);
345+
318346
/// Options which apply on a per-channel basis and may change at runtime or based on negotiation
319347
/// with our counterparty.
320348
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
@@ -374,13 +402,11 @@ pub struct ChannelConfig {
374402
/// (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
375403
/// account the HTLC transaction fee as it is zero.
376404
///
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.
405+
/// The selected limit is applied for sent, forwarded, and received HTLCs and limits the total
406+
/// exposure across all three types per-channel.
381407
///
382-
/// Default value: 5_000_000 msat.
383-
pub max_dust_htlc_exposure_msat: u64,
408+
/// Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of 5000.
409+
pub max_dust_htlc_exposure_msat: MaxDustHTLCExposure,
384410
/// The additional fee we're willing to pay to avoid waiting for the counterparty's
385411
/// `to_self_delay` to reclaim funds.
386412
///
@@ -436,21 +462,6 @@ pub struct ChannelConfig {
436462
/// [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat
437463
// TODO: link to bLIP when it's merged
438464
pub accept_underpaying_htlcs: bool,
439-
/// Similar to [`Self::max_dust_htlc_exposure_msat`], but instead of setting a fixed maximum,
440-
/// this sets a multiplier on the estimated high priority feerate (sats/KW, as obtained from
441-
/// [`FeeEstimator`]) to determine the maximum allowed dust exposure. If this field is set to
442-
/// `Some(value)`, then the maximum dust exposure in sats is calculated as:
443-
/// `high_priority_feerate_per_kw * value / 1000`.
444-
///
445-
/// This allows the maximum dust exposure to automatically scale with fee rate changes. With
446-
/// a fixed maximum, if the feerate increases significantly, then without a manually increase
447-
/// to this maximum, the channel may be unable to send/receive HTLCs between the maximum dust
448-
/// exposure and the new minimum value for HTLCs to be economically viable to claim.
449-
///
450-
/// Default value: `Some(5000)`.
451-
///
452-
/// [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator
453-
pub max_dust_htlc_exposure_multiplier_thousandths: Option<u64>,
454465
}
455466

456467
impl ChannelConfig {
@@ -471,9 +482,6 @@ impl ChannelConfig {
471482
if let Some(force_close_avoidance_max_fee_satoshis) = update.force_close_avoidance_max_fee_satoshis {
472483
self.force_close_avoidance_max_fee_satoshis = force_close_avoidance_max_fee_satoshis;
473484
}
474-
if let Some(max_dust_htlc_exposure_multiplier_thousandths) = update.max_dust_htlc_exposure_multiplier_thousandths {
475-
self.max_dust_htlc_exposure_multiplier_thousandths = max_dust_htlc_exposure_multiplier_thousandths;
476-
}
477485
}
478486
}
479487

@@ -484,36 +492,74 @@ impl Default for ChannelConfig {
484492
forwarding_fee_proportional_millionths: 0,
485493
forwarding_fee_base_msat: 1000,
486494
cltv_expiry_delta: 6 * 12, // 6 blocks/hour * 12 hours
487-
max_dust_htlc_exposure_msat: 5_000_000,
495+
max_dust_htlc_exposure_msat: MaxDustHTLCExposure::FeeRateMultiplier(5000),
488496
force_close_avoidance_max_fee_satoshis: 1000,
489497
accept_underpaying_htlcs: false,
490-
max_dust_htlc_exposure_multiplier_thousandths: Some(5000),
491498
}
492499
}
493500
}
494501

495-
impl_writeable_tlv_based!(ChannelConfig, {
496-
(0, forwarding_fee_proportional_millionths, required),
497-
(1, accept_underpaying_htlcs, (default_value, false)),
498-
(2, forwarding_fee_base_msat, required),
499-
(3, max_dust_htlc_exposure_multiplier_thousandths, option),
500-
(4, cltv_expiry_delta, required),
501-
(6, max_dust_htlc_exposure_msat, required),
502-
// ChannelConfig serialized this field with a required type of 8 prior to the introduction of
503-
// LegacyChannelConfig. To make sure that serialization is not compatible with this one, we use
504-
// the next required type of 10, which if seen by the old serialization will always fail.
505-
(10, force_close_avoidance_max_fee_satoshis, required),
506-
});
502+
impl crate::util::ser::Writeable for ChannelConfig {
503+
fn write<W: crate::util::ser::Writer>(&self, writer: &mut W) -> Result<(), crate::io::Error> {
504+
let max_dust_htlc_exposure_msat_fixed_limit = match self.max_dust_htlc_exposure_msat {
505+
MaxDustHTLCExposure::FixedLimitMsat(limit) => limit,
506+
MaxDustHTLCExposure::FeeRateMultiplier(_) => 5_000_000,
507+
};
508+
write_tlv_fields!(writer, {
509+
(0, self.forwarding_fee_proportional_millionths, required),
510+
(1, self.accept_underpaying_htlcs, (default_value, false)),
511+
(2, self.forwarding_fee_base_msat, required),
512+
(3, Some(self.max_dust_htlc_exposure_msat), option),
513+
(4, self.cltv_expiry_delta, required),
514+
(6, max_dust_htlc_exposure_msat_fixed_limit, required),
515+
// ChannelConfig serialized this field with a required type of 8 prior to the introduction of
516+
// LegacyChannelConfig. To make sure that serialization is not compatible with this one, we use
517+
// the next required type of 10, which if seen by the old serialization will always fail.
518+
(10, self.force_close_avoidance_max_fee_satoshis, required),
519+
});
520+
Ok(())
521+
}
522+
}
523+
524+
impl crate::util::ser::Readable for ChannelConfig {
525+
fn read<R: crate::io::Read>(reader: &mut R) -> Result<Self, crate::ln::msgs::DecodeError> {
526+
let mut forwarding_fee_proportional_millionths = 0;
527+
let mut accept_underpaying_htlcs = false;
528+
let mut forwarding_fee_base_msat = 1000;
529+
let mut cltv_expiry_delta = 6 * 12;
530+
let mut max_dust_htlc_exposure_msat = 5_000_000;
531+
let mut max_dust_htlc_exposure_enum = None;
532+
let mut force_close_avoidance_max_fee_satoshis = 1000;
533+
read_tlv_fields!(reader, {
534+
(0, forwarding_fee_proportional_millionths, required),
535+
(1, accept_underpaying_htlcs, (default_value, false)),
536+
(2, forwarding_fee_base_msat, required),
537+
(3, max_dust_htlc_exposure_enum, option),
538+
(4, cltv_expiry_delta, required),
539+
(6, max_dust_htlc_exposure_msat, required),
540+
(10, force_close_avoidance_max_fee_satoshis, required),
541+
});
542+
let max_dust_htlc_exposure_msat = max_dust_htlc_exposure_enum
543+
.unwrap_or(MaxDustHTLCExposure::FixedLimitMsat(max_dust_htlc_exposure_msat));
544+
Ok(Self {
545+
forwarding_fee_proportional_millionths,
546+
accept_underpaying_htlcs,
547+
forwarding_fee_base_msat,
548+
cltv_expiry_delta,
549+
max_dust_htlc_exposure_msat,
550+
force_close_avoidance_max_fee_satoshis,
551+
})
552+
}
553+
}
507554

508555
/// A parallel struct to [`ChannelConfig`] to define partial updates.
509556
#[allow(missing_docs)]
510557
pub struct ChannelConfigUpdate {
511558
pub forwarding_fee_proportional_millionths: Option<u32>,
512559
pub forwarding_fee_base_msat: Option<u32>,
513560
pub cltv_expiry_delta: Option<u16>,
514-
pub max_dust_htlc_exposure_msat: Option<u64>,
561+
pub max_dust_htlc_exposure_msat: Option<MaxDustHTLCExposure>,
515562
pub force_close_avoidance_max_fee_satoshis: Option<u64>,
516-
pub max_dust_htlc_exposure_multiplier_thousandths: Option<Option<u64>>,
517563
}
518564

519565
impl Default for ChannelConfigUpdate {
@@ -524,7 +570,6 @@ impl Default for ChannelConfigUpdate {
524570
cltv_expiry_delta: None,
525571
max_dust_htlc_exposure_msat: None,
526572
force_close_avoidance_max_fee_satoshis: None,
527-
max_dust_htlc_exposure_multiplier_thousandths: None,
528573
}
529574
}
530575
}
@@ -537,7 +582,6 @@ impl From<ChannelConfig> for ChannelConfigUpdate {
537582
cltv_expiry_delta: Some(config.cltv_expiry_delta),
538583
max_dust_htlc_exposure_msat: Some(config.max_dust_htlc_exposure_msat),
539584
force_close_avoidance_max_fee_satoshis: Some(config.force_close_avoidance_max_fee_satoshis),
540-
max_dust_htlc_exposure_multiplier_thousandths: Some(config.max_dust_htlc_exposure_multiplier_thousandths),
541585
}
542586
}
543587
}
@@ -569,13 +613,17 @@ impl Default for LegacyChannelConfig {
569613

570614
impl crate::util::ser::Writeable for LegacyChannelConfig {
571615
fn write<W: crate::util::ser::Writer>(&self, writer: &mut W) -> Result<(), crate::io::Error> {
616+
let max_dust_htlc_exposure_msat_fixed_limit = match self.options.max_dust_htlc_exposure_msat {
617+
MaxDustHTLCExposure::FixedLimitMsat(limit) => limit,
618+
MaxDustHTLCExposure::FeeRateMultiplier(_) => 5_000_000,
619+
};
572620
write_tlv_fields!(writer, {
573621
(0, self.options.forwarding_fee_proportional_millionths, required),
574-
(1, self.options.max_dust_htlc_exposure_msat, (default_value, 5_000_000)),
622+
(1, max_dust_htlc_exposure_msat_fixed_limit, (default_value, 5_000_000)),
575623
(2, self.options.cltv_expiry_delta, required),
576624
(3, self.options.force_close_avoidance_max_fee_satoshis, (default_value, 1000)),
577625
(4, self.announced_channel, required),
578-
(5, self.options.max_dust_htlc_exposure_multiplier_thousandths, option),
626+
(5, Some(self.options.max_dust_htlc_exposure_msat), option),
579627
(6, self.commit_upfront_shutdown_pubkey, required),
580628
(8, self.options.forwarding_fee_base_msat, required),
581629
});
@@ -586,23 +634,25 @@ impl crate::util::ser::Writeable for LegacyChannelConfig {
586634
impl crate::util::ser::Readable for LegacyChannelConfig {
587635
fn read<R: crate::io::Read>(reader: &mut R) -> Result<Self, crate::ln::msgs::DecodeError> {
588636
let mut forwarding_fee_proportional_millionths = 0;
589-
let mut max_dust_htlc_exposure_msat = 5_000_000;
637+
let mut max_dust_htlc_exposure_msat_fixed_limit = 5_000_000;
590638
let mut cltv_expiry_delta = 0;
591639
let mut force_close_avoidance_max_fee_satoshis = 1000;
592640
let mut announced_channel = false;
593641
let mut commit_upfront_shutdown_pubkey = false;
594642
let mut forwarding_fee_base_msat = 0;
595-
let mut max_dust_htlc_exposure_multiplier_thousandths = None;
643+
let mut max_dust_htlc_exposure_enum = None;
596644
read_tlv_fields!(reader, {
597645
(0, forwarding_fee_proportional_millionths, required),
598-
(1, max_dust_htlc_exposure_msat, (default_value, 5_000_000u64)),
646+
(1, max_dust_htlc_exposure_msat_fixed_limit, (default_value, 5_000_000u64)),
599647
(2, cltv_expiry_delta, required),
600648
(3, force_close_avoidance_max_fee_satoshis, (default_value, 1000u64)),
601649
(4, announced_channel, required),
602-
(5, max_dust_htlc_exposure_multiplier_thousandths, option),
650+
(5, max_dust_htlc_exposure_enum, option),
603651
(6, commit_upfront_shutdown_pubkey, required),
604652
(8, forwarding_fee_base_msat, required),
605653
});
654+
let max_dust_htlc_exposure_msat = max_dust_htlc_exposure_enum
655+
.unwrap_or(MaxDustHTLCExposure::FixedLimitMsat(max_dust_htlc_exposure_msat_fixed_limit));
606656
Ok(Self {
607657
options: ChannelConfig {
608658
forwarding_fee_proportional_millionths,
@@ -611,7 +661,6 @@ impl crate::util::ser::Readable for LegacyChannelConfig {
611661
force_close_avoidance_max_fee_satoshis,
612662
forwarding_fee_base_msat,
613663
accept_underpaying_htlcs: false,
614-
max_dust_htlc_exposure_multiplier_thousandths,
615664
},
616665
announced_channel,
617666
commit_upfront_shutdown_pubkey,

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)