]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Use a smaller bit for UnknownFeature
authorJeffrey Czyz <jkczyz@gmail.com>
Wed, 31 Jul 2024 20:12:40 +0000 (15:12 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Wed, 14 Aug 2024 15:55:55 +0000 (10:55 -0500)
When testing Bolt12Invoice unknown require feature handling, a large
feature bit can cause SendError::TooBigPacket when creating an onion
message. Use a smaller feature bit for UnknownFeature, which also has
the added benefit of reducing test output.

lightning-types/src/features.rs

index 3aec5358d2b15613e9c7c91adfdec62773871761..54587dc980a5cc004908e059881d5eafe2dc2a8b 100644 (file)
@@ -567,7 +567,7 @@ mod sealed {
 
        #[cfg(any(test, feature = "_test_utils"))]
        define_feature!(
-               123456789,
+               12345,
                UnknownFeature,
                [
                        NodeContext,
@@ -1117,7 +1117,7 @@ mod tests {
                features.set_unknown_feature_required();
                assert!(features.requires_unknown_bits());
                assert!(features.supports_unknown_bits());
-               assert_eq!(features.required_unknown_bits_from(&ChannelFeatures::empty()), vec![123456788]);
+               assert_eq!(features.required_unknown_bits_from(&ChannelFeatures::empty()), vec![12344]);
 
                let mut features = ChannelFeatures::empty();
                features.set_unknown_feature_optional();
@@ -1127,17 +1127,17 @@ mod tests {
 
                let mut features = ChannelFeatures::empty();
                features.set_unknown_feature_required();
-               features.set_custom_bit(123456786).unwrap();
+               features.set_custom_bit(12346).unwrap();
                assert!(features.requires_unknown_bits());
                assert!(features.supports_unknown_bits());
                assert_eq!(
                        features.required_unknown_bits_from(&ChannelFeatures::empty()),
-                       vec![123456786, 123456788]
+                       vec![12344, 12346]
                );
 
                let mut limiter = ChannelFeatures::empty();
                limiter.set_unknown_feature_optional();
-               assert_eq!(features.required_unknown_bits_from(&limiter), vec![123456786]);
+               assert_eq!(features.required_unknown_bits_from(&limiter), vec![12346]);
        }
 
        #[test]