From 05db67b5c3200adde275d562607da095e41eb8a4 Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Wed, 31 Jul 2024 15:12:40 -0500 Subject: [PATCH] Use a smaller bit for UnknownFeature 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 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lightning-types/src/features.rs b/lightning-types/src/features.rs index 3aec5358d..54587dc98 100644 --- a/lightning-types/src/features.rs +++ b/lightning-types/src/features.rs @@ -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] -- 2.39.5