From: Jeffrey Czyz Date: Wed, 7 Aug 2024 23:10:43 +0000 (-0500) Subject: Add offer test vectors for experimental TLVs X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=62cddb7d3a5b69d427a147b18d4f2dd0fdd56ee0;p=rust-lightning Add offer test vectors for experimental TLVs --- diff --git a/lightning/src/offers/offer.rs b/lightning/src/offers/offer.rs index 68f5c10fc..8d999ff80 100644 --- a/lightning/src/offers/offer.rs +++ b/lightning/src/offers/offer.rs @@ -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::() { @@ -2226,6 +2229,18 @@ mod bolt12_tests { Err(Bolt12ParseError::Decode(DecodeError::InvalidValue)), ); + // Contains type > 1999999999 + assert_eq!( + "lno1pgz5znzfgdz3vggzqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgp06ae4jsq9qgr0u2xq4dh3kdevrf4zg6hx8a60jv0gxe0ptgyfc6xkryqqqqqqqq".parse::(), + Err(Bolt12ParseError::Decode(DecodeError::InvalidValue)), + ); + + // Contains unknown even type (1000000002) + assert_eq!( + "lno1pgz5znzfgdz3vggzqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgp06wu6egp9qgr0u2xq4dh3kdevrf4zg6hx8a60jv0gxe0ptgyfc6xkryqqqqqqqq".parse::(), + Err(Bolt12ParseError::Decode(DecodeError::InvalidValue)), + ); + // TODO: Resolved in spec https://github.com/lightning/bolts/pull/798/files#r1334851959 // Contains unknown feature 22 assert!(