From: Jeffrey Czyz Date: Wed, 31 Jul 2024 20:12:40 +0000 (-0500) Subject: Use a smaller bit for UnknownFeature X-Git-Tag: v0.0.124-beta~12^2~10 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=05db67b5c3200adde275d562607da095e41eb8a4;p=rust-lightning 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. --- 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]