Skip to content

Commit a28a5ae

Browse files
committed
Set feature for InitContext and NodeContext.
1 parent 41ec78a commit a28a5ae

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lightning/src/ln/features.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ mod sealed {
130130
,
131131
// Byte 5
132132
,
133+
// Byte 6
134+
,
133135
],
134136
optional_features: [
135137
// Byte 0
@@ -144,6 +146,8 @@ mod sealed {
144146
,
145147
// Byte 5
146148
ChannelType | SCIDPrivacy,
149+
// Byte 6
150+
ZeroConf,
147151
],
148152
});
149153
define_context!(NodeContext {
@@ -177,7 +181,7 @@ mod sealed {
177181
// Byte 5
178182
ChannelType | SCIDPrivacy,
179183
// Byte 6
180-
Keysend,
184+
ZeroConf | Keysend,
181185
],
182186
});
183187
define_context!(ChannelContext {
@@ -406,7 +410,7 @@ mod sealed {
406410
define_feature!(47, SCIDPrivacy, [InitContext, NodeContext, ChannelTypeContext],
407411
"Feature flags for only forwarding with SCID aliasing. Called `option_scid_alias` in the BOLTs",
408412
set_scid_privacy_optional, set_scid_privacy_required, supports_scid_privacy, requires_scid_privacy);
409-
define_feature!(51, ZeroConf, [ChannelTypeContext],
413+
define_feature!(51, ZeroConf, [InitContext, NodeContext, ChannelTypeContext],
410414
"Feature flags for accepting channels with zero confirmations. Called `option_zeroconf` in the BOLTs",
411415
set_zero_conf_optional, set_zero_conf_required, supports_zero_conf, requires_zero_conf);
412416
define_feature!(55, Keysend, [NodeContext],
@@ -868,6 +872,10 @@ mod tests {
868872
assert!(!InitFeatures::known().requires_wumbo());
869873
assert!(!NodeFeatures::known().requires_wumbo());
870874

875+
assert!(InitFeatures::known().supports_zero_conf());
876+
assert!(!InitFeatures::known().requires_zero_conf());
877+
assert!(NodeFeatures::known().supports_zero_conf());
878+
assert!(!NodeFeatures::known().requires_zero_conf());
871879
assert!(ChannelTypeFeatures::known().supports_zero_conf());
872880
assert!(ChannelTypeFeatures::known().requires_zero_conf());
873881

@@ -910,13 +918,15 @@ mod tests {
910918
// - opt_shutdown_anysegwit
911919
// -
912920
// - option_channel_type | option_scid_alias
913-
assert_eq!(node_features.flags.len(), 6);
921+
// - option_zeroconf
922+
assert_eq!(node_features.flags.len(), 7);
914923
assert_eq!(node_features.flags[0], 0b00000010);
915924
assert_eq!(node_features.flags[1], 0b01010001);
916925
assert_eq!(node_features.flags[2], 0b00001010);
917926
assert_eq!(node_features.flags[3], 0b00001000);
918927
assert_eq!(node_features.flags[4], 0b00000000);
919928
assert_eq!(node_features.flags[5], 0b10100000);
929+
assert_eq!(node_features.flags[6], 0b00001000);
920930
}
921931

922932
// Check that cleared flags are kept blank when converting back:

0 commit comments

Comments
 (0)