Skip to content

Commit 18240c6

Browse files
committed
f Fix incorrect/early feature addition noted by Jeff (TODO: Tweak commit message)
1 parent b6c92e1 commit 18240c6

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

lightning/src/ln/features.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ mod sealed {
9797
// Byte 0
9898
DataLossProtect | InitialRoutingSync | UpfrontShutdownScript,
9999
// Byte 1
100-
VariableLengthOnion | StaticRemoteKey | PaymentSecret,
100+
VariableLengthOnion | PaymentSecret,
101101
// Byte 2
102102
BasicMPP,
103103
],
@@ -115,7 +115,7 @@ mod sealed {
115115
// Byte 0
116116
DataLossProtect | UpfrontShutdownScript,
117117
// Byte 1
118-
VariableLengthOnion | StaticRemoteKey | PaymentSecret,
118+
VariableLengthOnion | PaymentSecret,
119119
// Byte 2
120120
BasicMPP,
121121
],
@@ -476,6 +476,10 @@ impl<T: sealed::StaticRemoteKey> Features<T> {
476476
pub(crate) fn supports_static_remote_key(&self) -> bool {
477477
<T as sealed::StaticRemoteKey>::supports_feature(&self.flags)
478478
}
479+
#[cfg(test)]
480+
pub(crate) fn requires_static_remote_key(&self) -> bool {
481+
<T as sealed::StaticRemoteKey>::requires_feature(&self.flags)
482+
}
479483
}
480484

481485
impl<T: sealed::InitialRoutingSync> Features<T> {
@@ -563,6 +567,11 @@ mod tests {
563567
assert!(!InitFeatures::known().requires_variable_length_onion());
564568
assert!(!NodeFeatures::known().requires_variable_length_onion());
565569

570+
assert!(!InitFeatures::known().supports_static_remote_key());
571+
assert!(!NodeFeatures::known().supports_static_remote_key());
572+
assert!(!InitFeatures::known().requires_static_remote_key());
573+
assert!(!NodeFeatures::known().requires_static_remote_key());
574+
566575
assert!(InitFeatures::known().supports_payment_secret());
567576
assert!(NodeFeatures::known().supports_payment_secret());
568577
assert!(!InitFeatures::known().requires_payment_secret());
@@ -608,11 +617,11 @@ mod tests {
608617
{
609618
// Check that the flags are as expected:
610619
// - option_data_loss_protect
611-
// - var_onion_optin | static_remote_key | payment_secret
620+
// - var_onion_optin | payment_secret
612621
// - basic_mpp
613622
assert_eq!(node_features.flags.len(), 3);
614623
assert_eq!(node_features.flags[0], 0b00000010);
615-
assert_eq!(node_features.flags[1], 0b10100010);
624+
assert_eq!(node_features.flags[1], 0b10000010);
616625
assert_eq!(node_features.flags[2], 0b00000010);
617626
}
618627

0 commit comments

Comments
 (0)