From 6008e04bed01bb8722cdb3adfda4b5bc4cba9d3c Mon Sep 17 00:00:00 2001 From: Leo Nash Date: Tue, 23 Sep 2025 09:25:14 +0000 Subject: [PATCH 1/2] Add an experimental +100 offset to the 0FC feature bit --- lightning-types/src/features.rs | 50 ++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/lightning-types/src/features.rs b/lightning-types/src/features.rs index fda36b2c453..b35cba437f0 100644 --- a/lightning-types/src/features.rs +++ b/lightning-types/src/features.rs @@ -162,13 +162,17 @@ mod sealed { // Byte 4 Quiescence | OnionMessages, // Byte 5 - ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments, + ProvideStorage | ChannelType | SCIDPrivacy, // Byte 6 ZeroConf, // Byte 7 Trampoline | SimpleClose | Splice, - // Byte 8 - 130 - ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, + // Byte 8 - 16 + ,,,,,,,,, + // Byte 17 + AnchorZeroFeeCommitmentsStaging, + // Byte 18 - 130 + ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, // Byte 131 HtlcHold, ] @@ -187,13 +191,17 @@ mod sealed { // Byte 4 Quiescence | OnionMessages, // Byte 5 - ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments, + ProvideStorage | ChannelType | SCIDPrivacy, // Byte 6 ZeroConf | Keysend, // Byte 7 Trampoline | SimpleClose | Splice, - // Byte 8 - 31 - ,,,,,,,,,,,,,,,,,,,,,,,, + // Byte 8 - 16 + ,,,,,,,,, + // Byte 17 + AnchorZeroFeeCommitmentsStaging, + // Byte 18 - 31 + ,,,,,,,,,,,,,, // Byte 32 DnsResolver, // Byte 33 - 130 @@ -256,9 +264,13 @@ mod sealed { // Byte 4 , // Byte 5 - SCIDPrivacy | AnchorZeroFeeCommitments, + SCIDPrivacy, // Byte 6 ZeroConf, + // Byte 7 - 16 + ,,,,,,,,,, + // Byte 17 + AnchorZeroFeeCommitmentsStaging, ]); /// Defines a feature with the given bits for the specified [`Context`]s. The generated trait is @@ -594,17 +606,6 @@ mod sealed { supports_onion_messages, requires_onion_messages ); - define_feature!( - 41, - AnchorZeroFeeCommitments, - [InitContext, NodeContext, ChannelTypeContext], - "Feature flags for `option_zero_fee_commitments`.", - set_anchor_zero_fee_commitments_optional, - set_anchor_zero_fee_commitments_required, - clear_anchor_zero_fee_commitments, - supports_anchor_zero_fee_commitments, - requires_anchor_zero_fee_commitments - ); define_feature!( 43, ProvideStorage, @@ -698,6 +699,17 @@ mod sealed { // By default, allocate enough bytes to cover up to Splice. Update this as new features are // added which we expect to appear commonly across contexts. pub(super) const MIN_FEATURES_ALLOCATION_BYTES: usize = (63 + 7) / 8; + define_feature!( + 141, // The BOLTs PR uses feature bit 40/41, so add +100 for the experimental bit + AnchorZeroFeeCommitmentsStaging, + [InitContext, NodeContext, ChannelTypeContext], + "Feature flags for `option_zero_fee_commitments`.", + set_anchor_zero_fee_commitments_optional, + set_anchor_zero_fee_commitments_required, + clear_anchor_zero_fee_commitments, + supports_anchor_zero_fee_commitments, + requires_anchor_zero_fee_commitments + ); define_feature!( 259, DnsResolver, @@ -1074,7 +1086,7 @@ impl ChannelTypeFeatures { /// Constructs a ChannelTypeFeatures with zero fee commitment anchors support. pub fn anchors_zero_fee_commitments() -> Self { let mut ret = Self::empty(); - ::set_required_bit( + ::set_required_bit( &mut ret, ); ret From 7ce1ee8b361bef9bc992082cb08c131f032ba7a5 Mon Sep 17 00:00:00 2001 From: Leo Nash Date: Tue, 23 Sep 2025 21:02:53 +0000 Subject: [PATCH 2/2] Move experimental `HtlcHold` bit from 1053 to 153 We prefer to stay within the 0-255 range reserved for bolts, as bits > 255 can be used by bLIPs. --- lightning-types/src/features.rs | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/lightning-types/src/features.rs b/lightning-types/src/features.rs index b35cba437f0..835c8d2e687 100644 --- a/lightning-types/src/features.rs +++ b/lightning-types/src/features.rs @@ -171,9 +171,9 @@ mod sealed { ,,,,,,,,, // Byte 17 AnchorZeroFeeCommitmentsStaging, - // Byte 18 - 130 - ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, - // Byte 131 + // Byte 18 + , + // Byte 19 HtlcHold, ] ); @@ -200,14 +200,14 @@ mod sealed { ,,,,,,,,, // Byte 17 AnchorZeroFeeCommitmentsStaging, - // Byte 18 - 31 - ,,,,,,,,,,,,,, + // Byte 18 + , + // Byte 19 + HtlcHold, + // Byte 20 - 31 + ,,,,,,,,,,,, // Byte 32 DnsResolver, - // Byte 33 - 130 - ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, - // Byte 131 - HtlcHold, ] ); define_context!(ChannelContext, []); @@ -710,6 +710,17 @@ mod sealed { supports_anchor_zero_fee_commitments, requires_anchor_zero_fee_commitments ); + define_feature!( + 153, // The BOLTs PR uses feature bit 52/53, so add +100 for the experimental bit + HtlcHold, + [InitContext, NodeContext], + "Feature flags for holding HTLCs and forwarding on receipt of an onion message", + set_htlc_hold_optional, + set_htlc_hold_required, + clear_htlc_hold, + supports_htlc_hold, + requires_htlc_hold + ); define_feature!( 259, DnsResolver, @@ -721,17 +732,6 @@ mod sealed { supports_dns_resolution, requires_dns_resolution ); - define_feature!( - 1053, // The BOLTs PR uses feature bit 52/53, so add +1000 for the experimental bit - HtlcHold, - [InitContext, NodeContext], - "Feature flags for holding HTLCs and forwarding on receipt of an onion message", - set_htlc_hold_optional, - set_htlc_hold_required, - clear_htlc_hold, - supports_htlc_hold, - requires_htlc_hold - ); // Note: update the module-level docs when a new feature bit is added!