]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Require feature var_onion_optin
authorJeffrey Czyz <jkczyz@gmail.com>
Fri, 30 Apr 2021 16:41:46 +0000 (09:41 -0700)
committerJeffrey Czyz <jkczyz@gmail.com>
Fri, 30 Apr 2021 19:04:30 +0000 (12:04 -0700)
Feature payment_secret is required and depends on var_onion_optin, so
the latter must also be required.

lightning/src/ln/features.rs

index 02e403b46d9708100f2b86bb0d3346922a9235a6..507316d6b3b4612d1f9d5725e85dea956a87271b 100644 (file)
@@ -95,7 +95,7 @@ mod sealed {
                        // Byte 0
                        ,
                        // Byte 1
-                       StaticRemoteKey | PaymentSecret,
+                       VariableLengthOnion | StaticRemoteKey | PaymentSecret,
                        // Byte 2
                        ,
                        // Byte 3
@@ -105,7 +105,7 @@ mod sealed {
                        // Byte 0
                        DataLossProtect | InitialRoutingSync | UpfrontShutdownScript | GossipQueries,
                        // Byte 1
-                       VariableLengthOnion,
+                       ,
                        // Byte 2
                        BasicMPP,
                        // Byte 3
@@ -117,7 +117,7 @@ mod sealed {
                        // Byte 0
                        ,
                        // Byte 1
-                       StaticRemoteKey | PaymentSecret,
+                       VariableLengthOnion | StaticRemoteKey | PaymentSecret,
                        // Byte 2
                        ,
                        // Byte 3
@@ -127,7 +127,7 @@ mod sealed {
                        // Byte 0
                        DataLossProtect | UpfrontShutdownScript | GossipQueries,
                        // Byte 1
-                       VariableLengthOnion,
+                       ,
                        // Byte 2
                        BasicMPP,
                        // Byte 3
@@ -143,7 +143,7 @@ mod sealed {
                        // Byte 0
                        ,
                        // Byte 1
-                       PaymentSecret,
+                       VariableLengthOnion | PaymentSecret,
                        // Byte 2
                        ,
                ],
@@ -151,7 +151,7 @@ mod sealed {
                        // Byte 0
                        ,
                        // Byte 1
-                       VariableLengthOnion,
+                       ,
                        // Byte 2
                        BasicMPP,
                ],
@@ -730,8 +730,8 @@ mod tests {
 
                assert!(InitFeatures::known().supports_variable_length_onion());
                assert!(NodeFeatures::known().supports_variable_length_onion());
-               assert!(!InitFeatures::known().requires_variable_length_onion());
-               assert!(!NodeFeatures::known().requires_variable_length_onion());
+               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());
@@ -787,12 +787,12 @@ mod tests {
                {
                        // Check that the flags are as expected:
                        // - option_data_loss_protect
-                       // - var_onion_optin | static_remote_key (req) | payment_secret(req)
+                       // - var_onion_optin (req) | static_remote_key (req) | payment_secret(req)
                        // - basic_mpp
                        // - opt_shutdown_anysegwit
                        assert_eq!(node_features.flags.len(), 4);
                        assert_eq!(node_features.flags[0], 0b00000010);
-                       assert_eq!(node_features.flags[1], 0b01010010);
+                       assert_eq!(node_features.flags[1], 0b01010001);
                        assert_eq!(node_features.flags[2], 0b00000010);
                        assert_eq!(node_features.flags[3], 0b00001000);
                }