From: Matt Corallo Date: Sun, 3 May 2020 01:58:11 +0000 (-0400) Subject: f Fix incorrect/early feature addition noted by Jeff (TODO: Tweak commit message) X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=18240c676104110a12a8a398bb9f9fae3b8a78c3;p=rust-lightning f Fix incorrect/early feature addition noted by Jeff (TODO: Tweak commit message) --- diff --git a/lightning/src/ln/features.rs b/lightning/src/ln/features.rs index 4f263d475..ad8942326 100644 --- a/lightning/src/ln/features.rs +++ b/lightning/src/ln/features.rs @@ -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 Features { pub(crate) fn supports_static_remote_key(&self) -> bool { ::supports_feature(&self.flags) } + #[cfg(test)] + pub(crate) fn requires_static_remote_key(&self) -> bool { + ::requires_feature(&self.flags) + } } impl Features { @@ -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); }