]> git.bitcoin.ninja Git - rust-lightning/commitdiff
f Fix incorrect/early feature addition noted by Jeff (TODO: Tweak commit message)
authorMatt Corallo <git@bluematt.me>
Sun, 3 May 2020 01:58:11 +0000 (21:58 -0400)
committerMatt Corallo <git@bluematt.me>
Sun, 3 May 2020 01:58:11 +0000 (21:58 -0400)
lightning/src/ln/features.rs

index 4f263d47592c9f94a7abb5bcceff2f705c297790..ad8942326322f75207e42d0a9ec3f09ee86fc0a7 100644 (file)
@@ -97,7 +97,7 @@ mod sealed {
                        // Byte 0
                        DataLossProtect | InitialRoutingSync | UpfrontShutdownScript,
                        // Byte 1
-                       VariableLengthOnion | StaticRemoteKey | PaymentSecret,
+                       VariableLengthOnion | PaymentSecret,
                        // Byte 2
                        BasicMPP,
                ],
@@ -115,7 +115,7 @@ mod sealed {
                        // Byte 0
                        DataLossProtect | UpfrontShutdownScript,
                        // Byte 1
-                       VariableLengthOnion | StaticRemoteKey | PaymentSecret,
+                       VariableLengthOnion | PaymentSecret,
                        // Byte 2
                        BasicMPP,
                ],
@@ -476,6 +476,10 @@ impl<T: sealed::StaticRemoteKey> Features<T> {
        pub(crate) fn supports_static_remote_key(&self) -> bool {
                <T as sealed::StaticRemoteKey>::supports_feature(&self.flags)
        }
+       #[cfg(test)]
+       pub(crate) fn requires_static_remote_key(&self) -> bool {
+               <T as sealed::StaticRemoteKey>::requires_feature(&self.flags)
+       }
 }
 
 impl<T: sealed::InitialRoutingSync> Features<T> {
@@ -563,6 +567,11 @@ mod tests {
                assert!(!InitFeatures::known().requires_variable_length_onion());
                assert!(!NodeFeatures::known().requires_variable_length_onion());
 
+               assert!(!InitFeatures::known().supports_static_remote_key());
+               assert!(!NodeFeatures::known().supports_static_remote_key());
+               assert!(!InitFeatures::known().requires_static_remote_key());
+               assert!(!NodeFeatures::known().requires_static_remote_key());
+
                assert!(InitFeatures::known().supports_payment_secret());
                assert!(NodeFeatures::known().supports_payment_secret());
                assert!(!InitFeatures::known().requires_payment_secret());
@@ -608,11 +617,11 @@ mod tests {
                {
                        // Check that the flags are as expected:
                        // - option_data_loss_protect
-                       // - var_onion_optin | static_remote_key | payment_secret
+                       // - var_onion_optin | payment_secret
                        // - basic_mpp
                        assert_eq!(node_features.flags.len(), 3);
                        assert_eq!(node_features.flags[0], 0b00000010);
-                       assert_eq!(node_features.flags[1], 0b10100010);
+                       assert_eq!(node_features.flags[1], 0b10000010);
                        assert_eq!(node_features.flags[2], 0b00000010);
                }