]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Add offer test vectors for experimental TLVs
authorJeffrey Czyz <jkczyz@gmail.com>
Wed, 7 Aug 2024 23:10:43 +0000 (18:10 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Tue, 5 Nov 2024 00:00:23 +0000 (18:00 -0600)
lightning/src/offers/offer.rs

index 68f5c10fc212c9726f9b0a635fb2f9220b8e5ed8..8d999ff8084f3dceae14a6593bd0e23cd58cc1fc 100644 (file)
@@ -2084,6 +2084,9 @@ mod bolt12_tests {
 
                        // unknown odd field
                        "lno1pgx9getnwss8vetrw3hhyuckyypwa3eyt44h6txtxquqh7lz5djge4afgfjn7k4rgrkuag0jsd5xvxfppf5x2mrvdamk7unvvs",
+
+                       // unknown odd experimental field
+                       "lno1pgx9getnwss8vetrw3hhyuckyypwa3eyt44h6txtxquqh7lz5djge4afgfjn7k4rgrkuag0jsd5xvx078wdv5gg2dpjkcmr0wahhymry",
                ];
                for encoded_offer in &offers {
                        if let Err(e) = encoded_offer.parse::<Offer>() {
@@ -2226,6 +2229,18 @@ mod bolt12_tests {
                        Err(Bolt12ParseError::Decode(DecodeError::InvalidValue)),
                );
 
+               // Contains type > 1999999999
+               assert_eq!(
+                       "lno1pgz5znzfgdz3vggzqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgp06ae4jsq9qgr0u2xq4dh3kdevrf4zg6hx8a60jv0gxe0ptgyfc6xkryqqqqqqqq".parse::<Offer>(),
+                       Err(Bolt12ParseError::Decode(DecodeError::InvalidValue)),
+               );
+
+               // Contains unknown even type (1000000002)
+               assert_eq!(
+                       "lno1pgz5znzfgdz3vggzqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgp06wu6egp9qgr0u2xq4dh3kdevrf4zg6hx8a60jv0gxe0ptgyfc6xkryqqqqqqqq".parse::<Offer>(),
+                       Err(Bolt12ParseError::Decode(DecodeError::InvalidValue)),
+               );
+
                // TODO: Resolved in spec https://github.com/lightning/bolts/pull/798/files#r1334851959
                // Contains unknown feature 22
                assert!(