@@ -22,6 +22,7 @@ use crate::offers::invoice_macros::{invoice_accessors_common, invoice_builder_me
2222use  crate :: offers:: merkle:: { 
2323	self ,  SignError ,  SignFn ,  SignatureTlvStream ,  SignatureTlvStreamRef ,  TaggedHash , 
2424} ; 
25+ use  crate :: offers:: nonce:: Nonce ; 
2526use  crate :: offers:: offer:: { 
2627	Amount ,  Offer ,  OfferContents ,  OfferTlvStream ,  OfferTlvStreamRef ,  Quantity , 
2728} ; 
@@ -97,7 +98,7 @@ impl<'a> StaticInvoiceBuilder<'a> {
9798 	pub  fn  for_offer_using_derived_keys < T :  secp256k1:: Signing > ( 
9899		offer :  & ' a  Offer ,  payment_paths :  Vec < ( BlindedPayInfo ,  BlindedPath ) > , 
99100		message_paths :  Vec < BlindedPath > ,  created_at :  Duration ,  expanded_key :  & ExpandedKey , 
100- 		secp_ctx :  & Secp256k1 < T > , 
101+ 		nonce :   Nonce ,   secp_ctx :  & Secp256k1 < T > , 
101102	)  -> Result < Self ,  Bolt12SemanticError >  { 
102103		if  offer. chains ( ) . len ( )  > 1  { 
103104			return  Err ( Bolt12SemanticError :: UnexpectedChain ) ; 
@@ -111,7 +112,7 @@ impl<'a> StaticInvoiceBuilder<'a> {
111112			offer. signing_pubkey ( ) . ok_or ( Bolt12SemanticError :: MissingSigningPubkey ) ?; 
112113
113114		let  keys = offer
114- 			. verify ( & expanded_key,  & secp_ctx) 
115+ 			. verify ( nonce ,   & expanded_key,  & secp_ctx) 
115116			. map_err ( |( ) | Bolt12SemanticError :: InvalidMetadata ) ?
116117			. 1 
117118			. ok_or ( Bolt12SemanticError :: MissingSigningPubkey ) ?; 
@@ -623,6 +624,7 @@ mod tests {
623624			vec ! [ blinded_path( ) ] , 
624625			now, 
625626			& expanded_key, 
627+ 			nonce, 
626628			& secp_ctx, 
627629		) 
628630		. unwrap ( ) 
@@ -662,6 +664,7 @@ mod tests {
662664			vec ! [ blinded_path( ) ] , 
663665			now, 
664666			& expanded_key, 
667+ 			nonce, 
665668			& secp_ctx, 
666669		) 
667670		. unwrap ( ) 
@@ -672,7 +675,7 @@ mod tests {
672675		invoice. write ( & mut  buffer) . unwrap ( ) ; 
673676
674677		assert_eq ! ( invoice. bytes,  buffer. as_slice( ) ) ; 
675- 		assert ! ( invoice. metadata( ) . is_some ( ) ) ; 
678+ 		assert_eq ! ( invoice. metadata( ) ,   None ) ; 
676679		assert_eq ! ( invoice. amount( ) ,  None ) ; 
677680		assert_eq ! ( invoice. description( ) ,  None ) ; 
678681		assert_eq ! ( invoice. offer_features( ) ,  & OfferFeatures :: empty( ) ) ; 
@@ -698,13 +701,12 @@ mod tests {
698701		) ; 
699702
700703		let  paths = vec ! [ blinded_path( ) ] ; 
701- 		let  metadata = vec ! [ 42 ;  16 ] ; 
702704		assert_eq ! ( 
703705			invoice. as_tlv_stream( ) , 
704706			( 
705707				OfferTlvStreamRef  { 
706708					chains:  None , 
707- 					metadata:  Some ( & metadata ) , 
709+ 					metadata:  None , 
708710					currency:  None , 
709711					amount:  None , 
710712					description:  None , 
@@ -762,6 +764,7 @@ mod tests {
762764			vec ! [ blinded_path( ) ] , 
763765			now, 
764766			& expanded_key, 
767+ 			nonce, 
765768			& secp_ctx, 
766769		) 
767770		. unwrap ( ) 
@@ -782,6 +785,7 @@ mod tests {
782785			vec ! [ blinded_path( ) ] , 
783786			now, 
784787			& expanded_key, 
788+ 			nonce, 
785789			& secp_ctx, 
786790		) 
787791		. unwrap ( ) 
@@ -815,6 +819,7 @@ mod tests {
815819			vec ! [ blinded_path( ) ] , 
816820			now, 
817821			& expanded_key, 
822+ 			nonce, 
818823			& secp_ctx, 
819824		)  { 
820825			assert_eq ! ( e,  Bolt12SemanticError :: MissingPaths ) ; 
@@ -829,6 +834,7 @@ mod tests {
829834			Vec :: new ( ) , 
830835			now, 
831836			& expanded_key, 
837+ 			nonce, 
832838			& secp_ctx, 
833839		)  { 
834840			assert_eq ! ( e,  Bolt12SemanticError :: MissingPaths ) ; 
@@ -849,6 +855,7 @@ mod tests {
849855			vec ! [ blinded_path( ) ] , 
850856			now, 
851857			& expanded_key, 
858+ 			nonce, 
852859			& secp_ctx, 
853860		)  { 
854861			assert_eq ! ( e,  Bolt12SemanticError :: MissingPaths ) ; 
@@ -886,6 +893,7 @@ mod tests {
886893			vec ! [ blinded_path( ) ] , 
887894			now, 
888895			& expanded_key, 
896+ 			nonce, 
889897			& secp_ctx, 
890898		)  { 
891899			assert_eq ! ( e,  Bolt12SemanticError :: MissingSigningPubkey ) ; 
@@ -906,6 +914,7 @@ mod tests {
906914			vec ! [ blinded_path( ) ] , 
907915			now, 
908916			& expanded_key, 
917+ 			nonce, 
909918			& secp_ctx, 
910919		)  { 
911920			assert_eq ! ( e,  Bolt12SemanticError :: InvalidMetadata ) ; 
@@ -937,6 +946,7 @@ mod tests {
937946			vec ! [ blinded_path( ) ] , 
938947			now, 
939948			& expanded_key, 
949+ 			nonce, 
940950			& secp_ctx, 
941951		)  { 
942952			assert_eq ! ( e,  Bolt12SemanticError :: UnexpectedChain ) ; 
@@ -967,6 +977,7 @@ mod tests {
967977			vec ! [ blinded_path( ) ] , 
968978			now, 
969979			& expanded_key, 
980+ 			nonce, 
970981			& secp_ctx, 
971982		) 
972983		. unwrap ( ) 
@@ -1007,6 +1018,7 @@ mod tests {
10071018			vec ! [ blinded_path( ) ] , 
10081019			now, 
10091020			& expanded_key, 
1021+ 			nonce, 
10101022			& secp_ctx, 
10111023		) 
10121024		. unwrap ( ) 
0 commit comments