Skip to content

Commit dea125a

Browse files
authored
Merge pull request #4108 from tankyleo/2025-09-0fc-experimental-bit
Add an experimental +1000 offset to the 0FC feature bit
2 parents 4c9c211 + 7ce1ee8 commit dea125a

File tree

1 file changed

+46
-34
lines changed

1 file changed

+46
-34
lines changed

lightning-types/src/features.rs

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,18 @@ mod sealed {
162162
// Byte 4
163163
Quiescence | OnionMessages,
164164
// Byte 5
165-
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
165+
ProvideStorage | ChannelType | SCIDPrivacy,
166166
// Byte 6
167167
ZeroConf,
168168
// Byte 7
169169
Trampoline | SimpleClose | Splice,
170-
// Byte 8 - 130
171-
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
172-
// Byte 131
170+
// Byte 8 - 16
171+
,,,,,,,,,
172+
// Byte 17
173+
AnchorZeroFeeCommitmentsStaging,
174+
// Byte 18
175+
,
176+
// Byte 19
173177
HtlcHold,
174178
]
175179
);
@@ -187,19 +191,23 @@ mod sealed {
187191
// Byte 4
188192
Quiescence | OnionMessages,
189193
// Byte 5
190-
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
194+
ProvideStorage | ChannelType | SCIDPrivacy,
191195
// Byte 6
192196
ZeroConf | Keysend,
193197
// Byte 7
194198
Trampoline | SimpleClose | Splice,
195-
// Byte 8 - 31
196-
,,,,,,,,,,,,,,,,,,,,,,,,
199+
// Byte 8 - 16
200+
,,,,,,,,,
201+
// Byte 17
202+
AnchorZeroFeeCommitmentsStaging,
203+
// Byte 18
204+
,
205+
// Byte 19
206+
HtlcHold,
207+
// Byte 20 - 31
208+
,,,,,,,,,,,,
197209
// Byte 32
198210
DnsResolver,
199-
// Byte 33 - 130
200-
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
201-
// Byte 131
202-
HtlcHold,
203211
]
204212
);
205213
define_context!(ChannelContext, []);
@@ -256,9 +264,13 @@ mod sealed {
256264
// Byte 4
257265
,
258266
// Byte 5
259-
SCIDPrivacy | AnchorZeroFeeCommitments,
267+
SCIDPrivacy,
260268
// Byte 6
261269
ZeroConf,
270+
// Byte 7 - 16
271+
,,,,,,,,,,
272+
// Byte 17
273+
AnchorZeroFeeCommitmentsStaging,
262274
]);
263275

264276
/// Defines a feature with the given bits for the specified [`Context`]s. The generated trait is
@@ -594,17 +606,6 @@ mod sealed {
594606
supports_onion_messages,
595607
requires_onion_messages
596608
);
597-
define_feature!(
598-
41,
599-
AnchorZeroFeeCommitments,
600-
[InitContext, NodeContext, ChannelTypeContext],
601-
"Feature flags for `option_zero_fee_commitments`.",
602-
set_anchor_zero_fee_commitments_optional,
603-
set_anchor_zero_fee_commitments_required,
604-
clear_anchor_zero_fee_commitments,
605-
supports_anchor_zero_fee_commitments,
606-
requires_anchor_zero_fee_commitments
607-
);
608609
define_feature!(
609610
43,
610611
ProvideStorage,
@@ -699,18 +700,18 @@ mod sealed {
699700
// added which we expect to appear commonly across contexts.
700701
pub(super) const MIN_FEATURES_ALLOCATION_BYTES: usize = (63 + 7) / 8;
701702
define_feature!(
702-
259,
703-
DnsResolver,
704-
[NodeContext],
705-
"Feature flags for DNS resolving.",
706-
set_dns_resolution_optional,
707-
set_dns_resolution_required,
708-
clear_dns_resolution,
709-
supports_dns_resolution,
710-
requires_dns_resolution
703+
141, // The BOLTs PR uses feature bit 40/41, so add +100 for the experimental bit
704+
AnchorZeroFeeCommitmentsStaging,
705+
[InitContext, NodeContext, ChannelTypeContext],
706+
"Feature flags for `option_zero_fee_commitments`.",
707+
set_anchor_zero_fee_commitments_optional,
708+
set_anchor_zero_fee_commitments_required,
709+
clear_anchor_zero_fee_commitments,
710+
supports_anchor_zero_fee_commitments,
711+
requires_anchor_zero_fee_commitments
711712
);
712713
define_feature!(
713-
1053, // The BOLTs PR uses feature bit 52/53, so add +1000 for the experimental bit
714+
153, // The BOLTs PR uses feature bit 52/53, so add +100 for the experimental bit
714715
HtlcHold,
715716
[InitContext, NodeContext],
716717
"Feature flags for holding HTLCs and forwarding on receipt of an onion message",
@@ -720,6 +721,17 @@ mod sealed {
720721
supports_htlc_hold,
721722
requires_htlc_hold
722723
);
724+
define_feature!(
725+
259,
726+
DnsResolver,
727+
[NodeContext],
728+
"Feature flags for DNS resolving.",
729+
set_dns_resolution_optional,
730+
set_dns_resolution_required,
731+
clear_dns_resolution,
732+
supports_dns_resolution,
733+
requires_dns_resolution
734+
);
723735

724736
// Note: update the module-level docs when a new feature bit is added!
725737

@@ -1074,7 +1086,7 @@ impl ChannelTypeFeatures {
10741086
/// Constructs a ChannelTypeFeatures with zero fee commitment anchors support.
10751087
pub fn anchors_zero_fee_commitments() -> Self {
10761088
let mut ret = Self::empty();
1077-
<sealed::ChannelTypeContext as sealed::AnchorZeroFeeCommitments>::set_required_bit(
1089+
<sealed::ChannelTypeContext as sealed::AnchorZeroFeeCommitmentsStaging>::set_required_bit(
10781090
&mut ret,
10791091
);
10801092
ret

0 commit comments

Comments
 (0)