Skip to content

Commit 20b9ff6

Browse files
Advertise htlc_hold feature in ChannelManager
Now that we support the feature of sending payments as an often-offline sender to an often-offline recipient, including the sender's LSP-side, we can start conditionally advertising the feature bit to other nodes on the network.
1 parent d6a1dd1 commit 20b9ff6

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15036,6 +15036,12 @@ pub fn provided_init_features(config: &UserConfig) -> InitFeatures {
1503615036
features.set_anchor_zero_fee_commitments_optional();
1503715037
}
1503815038

15039+
// If we are configured to be an announced node, we are expected to be always-online and can
15040+
// advertise the htlc_hold feature.
15041+
if config.enable_htlc_hold {
15042+
features.set_htlc_hold_optional();
15043+
}
15044+
1503915045
features
1504015046
}
1504115047

lightning/src/util/config.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,17 @@ pub struct UserConfig {
947947
///
948948
/// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice
949949
pub hold_outbound_htlcs_at_next_hop: bool,
950+
/// LDK supports a feature for always-online nodes such that these nodes can hold onto an HTLC
951+
/// from an often-offline channel peer until the often-offline payment recipient sends an onion
952+
/// message telling the always-online node to release the HTLC. If this is set to `true`, our node
953+
/// will carry out this feature for channel peers that request it.
954+
///
955+
/// This should only be set to `true` for nodes which expect to be online reliably.
956+
///
957+
/// Setting this to `true` may break backwards compatibility with LDK versions <= 0.2.
958+
///
959+
/// Default value: `false`
960+
pub enable_htlc_hold: bool,
950961
}
951962

952963
impl Default for UserConfig {
@@ -962,6 +973,7 @@ impl Default for UserConfig {
962973
manually_handle_bolt12_invoices: false,
963974
enable_dual_funded_channels: false,
964975
hold_outbound_htlcs_at_next_hop: true,
976+
enable_htlc_hold: false,
965977
}
966978
}
967979
}
@@ -982,7 +994,8 @@ impl Readable for UserConfig {
982994
accept_intercept_htlcs: Readable::read(reader)?,
983995
manually_handle_bolt12_invoices: Readable::read(reader)?,
984996
enable_dual_funded_channels: Readable::read(reader)?,
985-
send_payments_async: Readable::read(reader)?,
997+
hold_outbound_htlcs_at_next_hop: Readable::read(reader)?,
998+
enable_htlc_hold: Readable::read(reader)?,
986999
})
9871000
}
9881001
}

0 commit comments

Comments
 (0)