@@ -595,13 +595,13 @@ mod tests {
595595 . build ( )
596596 . unwrap ( ) ;
597597
598- let ( _offer_id, keys_opt) = offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
599598 let invoice = StaticInvoiceBuilder :: for_offer_using_keys (
600599 & offer,
601600 payment_paths. clone ( ) ,
602601 vec ! [ blinded_path( ) ] ,
603602 now,
604- keys_opt. unwrap ( ) ,
603+ & expanded_key,
604+ & secp_ctx,
605605 )
606606 . unwrap ( )
607607 . build_and_sign ( & secp_ctx)
@@ -630,6 +630,7 @@ mod tests {
630630 assert ! ( invoice. fallbacks( ) . is_empty( ) ) ;
631631 assert_eq ! ( invoice. invoice_features( ) , & Bolt12InvoiceFeatures :: empty( ) ) ;
632632
633+ let keys_opt = offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) . 1 ;
633634 let message = TaggedHash :: from_valid_tlv_stream_bytes ( SIGNATURE_TAG , & invoice. bytes ) ;
634635 assert ! ( merkle:: verify_signature(
635636 & invoice. signature,
@@ -662,13 +663,13 @@ mod tests {
662663 . build ( )
663664 . unwrap ( ) ;
664665
665- let ( _offer_id, keys_opt) = valid_offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
666666 let invoice = StaticInvoiceBuilder :: for_offer_using_keys (
667667 & valid_offer,
668668 payment_paths ( ) ,
669669 vec ! [ blinded_path( ) ] ,
670670 now,
671- keys_opt. unwrap ( ) ,
671+ & expanded_key,
672+ & secp_ctx,
672673 )
673674 . unwrap ( )
674675 . build_and_sign ( & secp_ctx)
@@ -682,13 +683,13 @@ mod tests {
682683 . absolute_expiry ( past_expiry)
683684 . build ( )
684685 . unwrap ( ) ;
685- let ( _offer_id, keys_opt) = expired_offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
686686 if let Err ( e) = StaticInvoiceBuilder :: for_offer_using_keys (
687687 & expired_offer,
688688 payment_paths ( ) ,
689689 vec ! [ blinded_path( ) ] ,
690690 now,
691- keys_opt. unwrap ( ) ,
691+ & expanded_key,
692+ & secp_ctx,
692693 )
693694 . unwrap ( )
694695 . build_and_sign ( & secp_ctx)
@@ -720,7 +721,8 @@ mod tests {
720721 Vec :: new ( ) ,
721722 vec ! [ blinded_path( ) ] ,
722723 now,
723- keys_opt. unwrap ( ) ,
724+ & expanded_key,
725+ & secp_ctx,
724726 ) {
725727 assert_eq ! ( e, Bolt12SemanticError :: MissingPaths ) ;
726728 } else {
@@ -733,7 +735,8 @@ mod tests {
733735 payment_paths ( ) ,
734736 Vec :: new ( ) ,
735737 now,
736- keys_opt. unwrap ( ) ,
738+ & expanded_key,
739+ & secp_ctx,
737740 ) {
738741 assert_eq ! ( e, Bolt12SemanticError :: MissingPaths ) ;
739742 } else {
@@ -752,7 +755,8 @@ mod tests {
752755 payment_paths ( ) ,
753756 vec ! [ blinded_path( ) ] ,
754757 now,
755- keys_opt. unwrap ( ) ,
758+ & expanded_key,
759+ & secp_ctx,
756760 ) {
757761 assert_eq ! ( e, Bolt12SemanticError :: MissingPaths ) ;
758762 } else {
@@ -773,7 +777,6 @@ mod tests {
773777 . path ( blinded_path ( ) )
774778 . build ( )
775779 . unwrap ( ) ;
776- let ( _offer_id, keys_opt) = valid_offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
777780
778781 // Error if offer signing pubkey is missing.
779782 let mut offer_missing_signing_pubkey = valid_offer. clone ( ) ;
@@ -788,14 +791,15 @@ mod tests {
788791 payment_paths ( ) ,
789792 vec ! [ blinded_path( ) ] ,
790793 now,
791- keys_opt. unwrap ( ) ,
794+ & expanded_key,
795+ & secp_ctx,
792796 ) {
793797 assert_eq ! ( e, Bolt12SemanticError :: MissingSigningPubkey ) ;
794798 } else {
795799 panic ! ( "expected error" )
796800 }
797801
798- // Error if the offer's signing pubkey doesn't match the invoice's .
802+ // Error if the offer's metadata cannot be verified .
799803 let mut offer_invalid_signing_pubkey = valid_offer. clone ( ) ;
800804 let mut offer_tlv_stream = offer_invalid_signing_pubkey. as_tlv_stream ( ) ;
801805 let invalid_node_id = payer_pubkey ( ) ;
@@ -809,9 +813,10 @@ mod tests {
809813 payment_paths ( ) ,
810814 vec ! [ blinded_path( ) ] ,
811815 now,
812- keys_opt. unwrap ( ) ,
816+ & expanded_key,
817+ & secp_ctx,
813818 ) {
814- assert_eq ! ( e, Bolt12SemanticError :: InvalidSigningPubkey ) ;
819+ assert_eq ! ( e, Bolt12SemanticError :: InvalidMetadata ) ;
815820 } else {
816821 panic ! ( "expected error" )
817822 }
@@ -832,15 +837,14 @@ mod tests {
832837 . chain ( Network :: Testnet )
833838 . build ( )
834839 . unwrap ( ) ;
835- let ( _offer_id, keys_opt) =
836- offer_with_extra_chain. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
837840
838841 if let Err ( e) = StaticInvoiceBuilder :: for_offer_using_keys (
839842 & offer_with_extra_chain,
840843 payment_paths ( ) ,
841844 vec ! [ blinded_path( ) ] ,
842845 now,
843- keys_opt. unwrap ( ) ,
846+ & expanded_key,
847+ & secp_ctx,
844848 ) {
845849 assert_eq ! ( e, Bolt12SemanticError :: UnexpectedChain ) ;
846850 } else {
0 commit comments