Skip to content

Commit 2a3e002

Browse files
committed
Allow channel update for accept_underpaying_htlcs
Extends partial channel updates to optionally include the accept_underpaying_htlcs flag.
1 parent b05402a commit 2a3e002

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15759,10 +15759,12 @@ mod tests {
1575915759
let new_fee = user_config.channel_config.forwarding_fee_proportional_millionths + 100;
1576015760
nodes[0].node.update_partial_channel_config(&channel.counterparty.node_id, &[channel.channel_id], &ChannelConfigUpdate {
1576115761
forwarding_fee_proportional_millionths: Some(new_fee),
15762+
accept_underpaying_htlcs: Some(true),
1576215763
..Default::default()
1576315764
}).unwrap();
1576415765
assert_eq!(nodes[0].node.list_channels()[0].config.unwrap().cltv_expiry_delta, new_cltv_expiry_delta);
1576515766
assert_eq!(nodes[0].node.list_channels()[0].config.unwrap().forwarding_fee_proportional_millionths, new_fee);
15767+
assert_eq!(nodes[0].node.list_channels()[0].config.unwrap().accept_underpaying_htlcs, true);
1576615768
let events = nodes[0].node.get_and_clear_pending_msg_events();
1576715769
assert_eq!(events.len(), 1);
1576815770
match &events[0] {

lightning/src/util/config.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,9 @@ impl ChannelConfig {
601601
{
602602
self.force_close_avoidance_max_fee_satoshis = force_close_avoidance_max_fee_satoshis;
603603
}
604+
if let Some(accept_underpaying_htlcs) = update.accept_underpaying_htlcs {
605+
self.accept_underpaying_htlcs = accept_underpaying_htlcs;
606+
}
604607
}
605608
}
606609

@@ -674,14 +677,30 @@ impl crate::util::ser::Readable for ChannelConfig {
674677
}
675678

676679
/// A parallel struct to [`ChannelConfig`] to define partial updates.
677-
#[allow(missing_docs)]
678680
#[derive(Default)]
679681
pub struct ChannelConfigUpdate {
682+
/// Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound over the channel. See
683+
/// [`ChannelConfig::forwarding_fee_proportional_millionths`].
680684
pub forwarding_fee_proportional_millionths: Option<u32>,
685+
686+
/// Amount (in milli-satoshi) charged for payments forwarded outbound over the channel. See
687+
/// [`ChannelConfig::forwarding_fee_base_msat`].
681688
pub forwarding_fee_base_msat: Option<u32>,
689+
690+
/// The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over the channel this
691+
/// config applies to. See [`ChannelConfig::cltv_expiry_delta`].
682692
pub cltv_expiry_delta: Option<u16>,
693+
694+
/// The total exposure we are willing to allow to dust HTLCs. See [`ChannelConfig::max_dust_htlc_exposure`].
683695
pub max_dust_htlc_exposure_msat: Option<MaxDustHTLCExposure>,
696+
697+
/// The additional fee we're willing to pay to avoid waiting for the counterparty's `to_self_delay` to reclaim
698+
/// funds. See [`ChannelConfig::force_close_avoidance_max_fee_satoshis`].
684699
pub force_close_avoidance_max_fee_satoshis: Option<u64>,
700+
701+
/// If set, allows this channel's counterparty to skim an additional fee off this node's inbound HTLCs. See
702+
/// [`ChannelConfig::accept_underpaying_htlcs`].
703+
pub accept_underpaying_htlcs: Option<bool>,
685704
}
686705

687706
impl From<ChannelConfig> for ChannelConfigUpdate {
@@ -696,6 +715,7 @@ impl From<ChannelConfig> for ChannelConfigUpdate {
696715
force_close_avoidance_max_fee_satoshis: Some(
697716
config.force_close_avoidance_max_fee_satoshis,
698717
),
718+
accept_underpaying_htlcs: Some(config.accept_underpaying_htlcs),
699719
}
700720
}
701721
}

0 commit comments

Comments
 (0)