@@ -595,13 +595,13 @@ mod tests {
595
595
. build ( )
596
596
. unwrap ( ) ;
597
597
598
- let ( _offer_id, keys_opt) = offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
599
598
let invoice = StaticInvoiceBuilder :: for_offer_using_keys (
600
599
& offer,
601
600
payment_paths. clone ( ) ,
602
601
vec ! [ blinded_path( ) ] ,
603
602
now,
604
- keys_opt. unwrap ( ) ,
603
+ & expanded_key,
604
+ & secp_ctx,
605
605
)
606
606
. unwrap ( )
607
607
. build_and_sign ( & secp_ctx)
@@ -630,6 +630,7 @@ mod tests {
630
630
assert ! ( invoice. fallbacks( ) . is_empty( ) ) ;
631
631
assert_eq ! ( invoice. invoice_features( ) , & Bolt12InvoiceFeatures :: empty( ) ) ;
632
632
633
+ let keys_opt = offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) . 1 ;
633
634
let message = TaggedHash :: from_valid_tlv_stream_bytes ( SIGNATURE_TAG , & invoice. bytes ) ;
634
635
assert ! ( merkle:: verify_signature(
635
636
& invoice. signature,
@@ -662,13 +663,13 @@ mod tests {
662
663
. build ( )
663
664
. unwrap ( ) ;
664
665
665
- let ( _offer_id, keys_opt) = valid_offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
666
666
let invoice = StaticInvoiceBuilder :: for_offer_using_keys (
667
667
& valid_offer,
668
668
payment_paths ( ) ,
669
669
vec ! [ blinded_path( ) ] ,
670
670
now,
671
- keys_opt. unwrap ( ) ,
671
+ & expanded_key,
672
+ & secp_ctx,
672
673
)
673
674
. unwrap ( )
674
675
. build_and_sign ( & secp_ctx)
@@ -682,13 +683,13 @@ mod tests {
682
683
. absolute_expiry ( past_expiry)
683
684
. build ( )
684
685
. unwrap ( ) ;
685
- let ( _offer_id, keys_opt) = expired_offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
686
686
if let Err ( e) = StaticInvoiceBuilder :: for_offer_using_keys (
687
687
& expired_offer,
688
688
payment_paths ( ) ,
689
689
vec ! [ blinded_path( ) ] ,
690
690
now,
691
- keys_opt. unwrap ( ) ,
691
+ & expanded_key,
692
+ & secp_ctx,
692
693
)
693
694
. unwrap ( )
694
695
. build_and_sign ( & secp_ctx)
@@ -720,7 +721,8 @@ mod tests {
720
721
Vec :: new ( ) ,
721
722
vec ! [ blinded_path( ) ] ,
722
723
now,
723
- keys_opt. unwrap ( ) ,
724
+ & expanded_key,
725
+ & secp_ctx,
724
726
) {
725
727
assert_eq ! ( e, Bolt12SemanticError :: MissingPaths ) ;
726
728
} else {
@@ -733,7 +735,8 @@ mod tests {
733
735
payment_paths ( ) ,
734
736
Vec :: new ( ) ,
735
737
now,
736
- keys_opt. unwrap ( ) ,
738
+ & expanded_key,
739
+ & secp_ctx,
737
740
) {
738
741
assert_eq ! ( e, Bolt12SemanticError :: MissingPaths ) ;
739
742
} else {
@@ -752,7 +755,8 @@ mod tests {
752
755
payment_paths ( ) ,
753
756
vec ! [ blinded_path( ) ] ,
754
757
now,
755
- keys_opt. unwrap ( ) ,
758
+ & expanded_key,
759
+ & secp_ctx,
756
760
) {
757
761
assert_eq ! ( e, Bolt12SemanticError :: MissingPaths ) ;
758
762
} else {
@@ -773,7 +777,6 @@ mod tests {
773
777
. path ( blinded_path ( ) )
774
778
. build ( )
775
779
. unwrap ( ) ;
776
- let ( _offer_id, keys_opt) = valid_offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
777
780
778
781
// Error if offer signing pubkey is missing.
779
782
let mut offer_missing_signing_pubkey = valid_offer. clone ( ) ;
@@ -788,14 +791,15 @@ mod tests {
788
791
payment_paths ( ) ,
789
792
vec ! [ blinded_path( ) ] ,
790
793
now,
791
- keys_opt. unwrap ( ) ,
794
+ & expanded_key,
795
+ & secp_ctx,
792
796
) {
793
797
assert_eq ! ( e, Bolt12SemanticError :: MissingSigningPubkey ) ;
794
798
} else {
795
799
panic ! ( "expected error" )
796
800
}
797
801
798
- // Error if the offer's signing pubkey doesn't match the invoice's .
802
+ // Error if the offer's metadata cannot be verified .
799
803
let mut offer_invalid_signing_pubkey = valid_offer. clone ( ) ;
800
804
let mut offer_tlv_stream = offer_invalid_signing_pubkey. as_tlv_stream ( ) ;
801
805
let invalid_node_id = payer_pubkey ( ) ;
@@ -809,9 +813,10 @@ mod tests {
809
813
payment_paths ( ) ,
810
814
vec ! [ blinded_path( ) ] ,
811
815
now,
812
- keys_opt. unwrap ( ) ,
816
+ & expanded_key,
817
+ & secp_ctx,
813
818
) {
814
- assert_eq ! ( e, Bolt12SemanticError :: InvalidSigningPubkey ) ;
819
+ assert_eq ! ( e, Bolt12SemanticError :: InvalidMetadata ) ;
815
820
} else {
816
821
panic ! ( "expected error" )
817
822
}
@@ -832,15 +837,14 @@ mod tests {
832
837
. chain ( Network :: Testnet )
833
838
. build ( )
834
839
. unwrap ( ) ;
835
- let ( _offer_id, keys_opt) =
836
- offer_with_extra_chain. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
837
840
838
841
if let Err ( e) = StaticInvoiceBuilder :: for_offer_using_keys (
839
842
& offer_with_extra_chain,
840
843
payment_paths ( ) ,
841
844
vec ! [ blinded_path( ) ] ,
842
845
now,
843
- keys_opt. unwrap ( ) ,
846
+ & expanded_key,
847
+ & secp_ctx,
844
848
) {
845
849
assert_eq ! ( e, Bolt12SemanticError :: UnexpectedChain ) ;
846
850
} else {
0 commit comments