@@ -607,13 +607,13 @@ mod tests {
607
607
. build ( )
608
608
. unwrap ( ) ;
609
609
610
- let ( _offer_id, keys_opt) = offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
611
610
let invoice = StaticInvoiceBuilder :: for_offer_using_keys (
612
611
& offer,
613
612
payment_paths. clone ( ) ,
614
613
vec ! [ blinded_path( ) ] ,
615
614
now,
616
- keys_opt. unwrap ( ) ,
615
+ & expanded_key,
616
+ & secp_ctx,
617
617
)
618
618
. unwrap ( )
619
619
. build_and_sign ( & secp_ctx)
@@ -642,6 +642,7 @@ mod tests {
642
642
assert ! ( invoice. fallbacks( ) . is_empty( ) ) ;
643
643
assert_eq ! ( invoice. invoice_features( ) , & Bolt12InvoiceFeatures :: empty( ) ) ;
644
644
645
+ let keys_opt = offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) . 1 ;
645
646
let message = TaggedHash :: from_valid_tlv_stream_bytes ( SIGNATURE_TAG , & invoice. bytes ) ;
646
647
assert ! ( merkle:: verify_signature(
647
648
& invoice. signature,
@@ -674,13 +675,13 @@ mod tests {
674
675
. build ( )
675
676
. unwrap ( ) ;
676
677
677
- let ( _offer_id, keys_opt) = valid_offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
678
678
let invoice = StaticInvoiceBuilder :: for_offer_using_keys (
679
679
& valid_offer,
680
680
payment_paths ( ) ,
681
681
vec ! [ blinded_path( ) ] ,
682
682
now,
683
- keys_opt. unwrap ( ) ,
683
+ & expanded_key,
684
+ & secp_ctx,
684
685
)
685
686
. unwrap ( )
686
687
. build_and_sign ( & secp_ctx)
@@ -694,13 +695,13 @@ mod tests {
694
695
. absolute_expiry ( past_expiry)
695
696
. build ( )
696
697
. unwrap ( ) ;
697
- let ( _offer_id, keys_opt) = expired_offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
698
698
if let Err ( e) = StaticInvoiceBuilder :: for_offer_using_keys (
699
699
& expired_offer,
700
700
payment_paths ( ) ,
701
701
vec ! [ blinded_path( ) ] ,
702
702
now,
703
- keys_opt. unwrap ( ) ,
703
+ & expanded_key,
704
+ & secp_ctx,
704
705
)
705
706
. unwrap ( )
706
707
. build_and_sign ( & secp_ctx)
@@ -732,7 +733,8 @@ mod tests {
732
733
Vec :: new ( ) ,
733
734
vec ! [ blinded_path( ) ] ,
734
735
now,
735
- keys_opt. unwrap ( ) ,
736
+ & expanded_key,
737
+ & secp_ctx,
736
738
) {
737
739
assert_eq ! ( e, Bolt12SemanticError :: MissingPaths ) ;
738
740
} else {
@@ -745,7 +747,8 @@ mod tests {
745
747
payment_paths ( ) ,
746
748
Vec :: new ( ) ,
747
749
now,
748
- keys_opt. unwrap ( ) ,
750
+ & expanded_key,
751
+ & secp_ctx,
749
752
) {
750
753
assert_eq ! ( e, Bolt12SemanticError :: MissingPaths ) ;
751
754
} else {
@@ -764,7 +767,8 @@ mod tests {
764
767
payment_paths ( ) ,
765
768
vec ! [ blinded_path( ) ] ,
766
769
now,
767
- keys_opt. unwrap ( ) ,
770
+ & expanded_key,
771
+ & secp_ctx,
768
772
) {
769
773
assert_eq ! ( e, Bolt12SemanticError :: MissingPaths ) ;
770
774
} else {
@@ -785,7 +789,6 @@ mod tests {
785
789
. path ( blinded_path ( ) )
786
790
. build ( )
787
791
. unwrap ( ) ;
788
- let ( _offer_id, keys_opt) = valid_offer. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
789
792
790
793
// Error if offer signing pubkey is missing.
791
794
let mut offer_missing_signing_pubkey = valid_offer. clone ( ) ;
@@ -800,14 +803,15 @@ mod tests {
800
803
payment_paths ( ) ,
801
804
vec ! [ blinded_path( ) ] ,
802
805
now,
803
- keys_opt. unwrap ( ) ,
806
+ & expanded_key,
807
+ & secp_ctx,
804
808
) {
805
809
assert_eq ! ( e, Bolt12SemanticError :: MissingSigningPubkey ) ;
806
810
} else {
807
811
panic ! ( "expected error" )
808
812
}
809
813
810
- // Error if the offer's signing pubkey doesn't match the invoice's .
814
+ // Error if the offer's metadata cannot be verified .
811
815
let mut offer_invalid_signing_pubkey = valid_offer. clone ( ) ;
812
816
let mut offer_tlv_stream = offer_invalid_signing_pubkey. as_tlv_stream ( ) ;
813
817
let invalid_node_id = payer_pubkey ( ) ;
@@ -821,9 +825,10 @@ mod tests {
821
825
payment_paths ( ) ,
822
826
vec ! [ blinded_path( ) ] ,
823
827
now,
824
- keys_opt. unwrap ( ) ,
828
+ & expanded_key,
829
+ & secp_ctx,
825
830
) {
826
- assert_eq ! ( e, Bolt12SemanticError :: InvalidSigningPubkey ) ;
831
+ assert_eq ! ( e, Bolt12SemanticError :: InvalidMetadata ) ;
827
832
} else {
828
833
panic ! ( "expected error" )
829
834
}
@@ -844,15 +849,14 @@ mod tests {
844
849
. chain ( Network :: Testnet )
845
850
. build ( )
846
851
. unwrap ( ) ;
847
- let ( _offer_id, keys_opt) =
848
- offer_with_extra_chain. verify ( & expanded_key, & secp_ctx) . unwrap ( ) ;
849
852
850
853
if let Err ( e) = StaticInvoiceBuilder :: for_offer_using_keys (
851
854
& offer_with_extra_chain,
852
855
payment_paths ( ) ,
853
856
vec ! [ blinded_path( ) ] ,
854
857
now,
855
- keys_opt. unwrap ( ) ,
858
+ & expanded_key,
859
+ & secp_ctx,
856
860
) {
857
861
assert_eq ! ( e, Bolt12SemanticError :: UnexpectedChain ) ;
858
862
} else {
0 commit comments