@@ -41,7 +41,7 @@ use crate::offers::invoice::{
4141} ; 
4242use  crate :: offers:: invoice_error:: InvoiceError ; 
4343use  crate :: offers:: invoice_request:: { 
44- 	InvoiceRequest ,  InvoiceRequestBuilder ,  VerifiedInvoiceRequestLegacy , 
44+ 	InvoiceRequest ,  InvoiceRequestBuilder ,  VerifiedInvoiceRequestEnum , 
4545} ; 
4646use  crate :: offers:: nonce:: Nonce ; 
4747use  crate :: offers:: offer:: { DerivedMetadata ,  Offer ,  OfferBuilder } ; 
@@ -406,7 +406,7 @@ fn enqueue_onion_message_with_reply_paths<T: OnionMessageContents + Clone>(
406406pub  enum  InvreqResponseInstructions  { 
407407	/// We are the recipient of this payment, and a [`Bolt12Invoice`] should be sent in response to 
408408 	/// the invoice request since it is now verified. 
409-  	SendInvoice ( VerifiedInvoiceRequestLegacy ) , 
409+  	SendInvoice ( VerifiedInvoiceRequestEnum ) , 
410410	/// We are a static invoice server and should respond to this invoice request by retrieving the 
411411 	/// [`StaticInvoice`] corresponding to the `recipient_id` and `invoice_id` and calling 
412412 	/// `OffersMessageFlow::enqueue_static_invoice`. 
@@ -920,7 +920,7 @@ where
920920		Ok ( builder. into ( ) ) 
921921	} 
922922
923- 	/// Creates a response for the provided [`VerifiedInvoiceRequestLegacy `]. 
923+ 	/// Creates a response for the provided [`VerifiedInvoiceRequestEnum `]. 
924924 	/// 
925925 	/// A response can be either an [`OffersMessage::Invoice`] with additional [`MessageContext`], 
926926 	/// or an [`OffersMessage::InvoiceError`], depending on the [`InvoiceRequest`]. 
@@ -930,9 +930,8 @@ where
930930 	/// - We fail to generate a valid signed [`Bolt12Invoice`] for the [`InvoiceRequest`]. 
931931 	pub  fn  create_response_for_invoice_request < ES :  Deref ,  NS :  Deref ,  R :  Deref > ( 
932932		& self ,  signer :  & NS ,  router :  & R ,  entropy_source :  ES , 
933- 		invoice_request :  VerifiedInvoiceRequestLegacy ,  amount_msats :  u64 , 
934- 		payment_hash :  PaymentHash ,  payment_secret :  PaymentSecret , 
935- 		usable_channels :  Vec < ChannelDetails > , 
933+ 		invoice_request :  VerifiedInvoiceRequestEnum ,  amount_msats :  u64 ,  payment_hash :  PaymentHash , 
934+ 		payment_secret :  PaymentSecret ,  usable_channels :  Vec < ChannelDetails > , 
936935	)  -> ( OffersMessage ,  Option < MessageContext > ) 
937936	where 
938937		ES :: Target :  EntropySource , 
@@ -945,7 +944,7 @@ where
945944		let  relative_expiry = DEFAULT_RELATIVE_EXPIRY . as_secs ( )  as  u32 ; 
946945
947946		let  context = PaymentContext :: Bolt12Offer ( Bolt12OfferContext  { 
948- 			offer_id :  invoice_request. offer_id , 
947+ 			offer_id :  invoice_request. offer_id ( ) , 
949948			invoice_request :  invoice_request. fields ( ) , 
950949		} ) ; 
951950
@@ -968,35 +967,36 @@ where
968967		#[ cfg( not( feature = "std" ) ) ]  
969968		let  created_at = Duration :: from_secs ( self . highest_seen_timestamp . load ( Ordering :: Acquire )  as  u64 ) ; 
970969
971- 		let  response = if  invoice_request. keys . is_some ( )  { 
972- 			#[ cfg( feature = "std" ) ]  
973- 			let  builder = invoice_request. respond_using_derived_keys ( payment_paths,  payment_hash) ; 
974- 			#[ cfg( not( feature = "std" ) ) ]  
975- 			let  builder = invoice_request. respond_using_derived_keys_no_std ( 
976- 				payment_paths, 
977- 				payment_hash, 
978- 				created_at, 
979- 			) ; 
980- 			builder
981- 				. map ( InvoiceBuilder :: < DerivedSigningPubkey > :: from) 
982- 				. and_then ( |builder| builder. allow_mpp ( ) . build_and_sign ( secp_ctx) ) 
983- 				. map_err ( InvoiceError :: from) 
984- 		}  else  { 
985- 			#[ cfg( feature = "std" ) ]  
986- 			let  builder = invoice_request. respond_with ( payment_paths,  payment_hash) ; 
987- 			#[ cfg( not( feature = "std" ) ) ]  
988- 			let  builder = invoice_request. respond_with_no_std ( payment_paths,  payment_hash,  created_at) ; 
989- 			builder
990- 				. map ( InvoiceBuilder :: < ExplicitSigningPubkey > :: from) 
991- 				. and_then ( |builder| builder. allow_mpp ( ) . build ( ) ) 
992- 				. map_err ( InvoiceError :: from) 
993- 				. and_then ( |invoice| { 
994- 					#[ cfg( c_bindings) ]  
995- 					let  mut  invoice = invoice; 
996- 					invoice
997- 						. sign ( |invoice :  & UnsignedBolt12Invoice | signer. sign_bolt12_invoice ( invoice) ) 
998- 						. map_err ( InvoiceError :: from) 
999- 				} ) 
970+ 		let  response = match  invoice_request { 
971+ 			VerifiedInvoiceRequestEnum :: WithKeys ( request)  => { 
972+ 				#[ cfg( feature = "std" ) ]  
973+ 				let  builder = request. respond_using_derived_keys ( payment_paths,  payment_hash) ; 
974+ 				#[ cfg( not( feature = "std" ) ) ]  
975+ 				let  builder = request. respond_using_derived_keys_no_std ( payment_paths,  payment_hash,  created_at) ; 
976+ 				builder
977+ 					. map ( InvoiceBuilder :: < DerivedSigningPubkey > :: from) 
978+ 					. and_then ( |builder| builder. allow_mpp ( ) . build_and_sign ( secp_ctx) ) 
979+ 					. map_err ( InvoiceError :: from) 
980+ 			} , 
981+ 			VerifiedInvoiceRequestEnum :: WithoutKeys ( request)  => { 
982+ 				#[ cfg( feature = "std" ) ]  
983+ 				let  builder = request. respond_with ( payment_paths,  payment_hash) ; 
984+ 				#[ cfg( not( feature = "std" ) ) ]  
985+ 				let  builder = request. respond_with_no_std ( payment_paths,  payment_hash,  created_at) ; 
986+ 				builder
987+ 					. map ( InvoiceBuilder :: < ExplicitSigningPubkey > :: from) 
988+ 					. and_then ( |builder| builder. allow_mpp ( ) . build ( ) ) 
989+ 					. map_err ( InvoiceError :: from) 
990+ 					. and_then ( |invoice| { 
991+ 						#[ cfg( c_bindings) ]  
992+ 						let  mut  invoice = invoice; 
993+ 						invoice
994+ 							. sign ( |invoice :  & UnsignedBolt12Invoice | { 
995+ 								signer. sign_bolt12_invoice ( invoice) 
996+ 							} ) 
997+ 							. map_err ( InvoiceError :: from) 
998+ 					} ) 
999+ 			} , 
10001000		} ; 
10011001
10021002		match  response { 
0 commit comments