@@ -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 , InvoiceRequestVerifiedFromOffer ,
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 ( InvoiceRequestVerifiedFromOffer ) ,
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 [`InvoiceRequestVerifiedFromOffer `].
924924 ///
925925 /// A response can be either an [`OffersMessage::Invoice`] with additional [`MessageContext`],
926926 /// or an [`OffersMessage::InvoiceError`], depending on the [`InvoiceRequest`].
@@ -930,7 +930,7 @@ 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 ,
933+ invoice_request : InvoiceRequestVerifiedFromOffer , amount_msats : u64 ,
934934 payment_hash : PaymentHash , payment_secret : PaymentSecret ,
935935 usable_channels : Vec < ChannelDetails > ,
936936 ) -> ( OffersMessage , Option < MessageContext > )
@@ -945,7 +945,7 @@ where
945945 let relative_expiry = DEFAULT_RELATIVE_EXPIRY . as_secs ( ) as u32 ;
946946
947947 let context = PaymentContext :: Bolt12Offer ( Bolt12OfferContext {
948- offer_id : invoice_request. offer_id ,
948+ offer_id : invoice_request. offer_id ( ) ,
949949 invoice_request : invoice_request. fields ( ) ,
950950 } ) ;
951951
@@ -968,35 +968,36 @@ where
968968 #[ cfg( not( feature = "std" ) ) ]
969969 let created_at = Duration :: from_secs ( self . highest_seen_timestamp . load ( Ordering :: Acquire ) as u64 ) ;
970970
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- } )
971+ let response = match invoice_request {
972+ InvoiceRequestVerifiedFromOffer :: DerivedKeys ( request) => {
973+ #[ cfg( feature = "std" ) ]
974+ let builder = request. respond_using_derived_keys ( payment_paths, payment_hash) ;
975+ #[ cfg( not( feature = "std" ) ) ]
976+ let builder = request. respond_using_derived_keys_no_std ( payment_paths, payment_hash, created_at) ;
977+ builder
978+ . map ( InvoiceBuilder :: < DerivedSigningPubkey > :: from)
979+ . and_then ( |builder| builder. allow_mpp ( ) . build_and_sign ( secp_ctx) )
980+ . map_err ( InvoiceError :: from)
981+ } ,
982+ InvoiceRequestVerifiedFromOffer :: ExplicitKeys ( request) => {
983+ #[ cfg( feature = "std" ) ]
984+ let builder = request. respond_with ( payment_paths, payment_hash) ;
985+ #[ cfg( not( feature = "std" ) ) ]
986+ let builder = request. respond_with_no_std ( payment_paths, payment_hash, created_at) ;
987+ builder
988+ . map ( InvoiceBuilder :: < ExplicitSigningPubkey > :: from)
989+ . and_then ( |builder| builder. allow_mpp ( ) . build ( ) )
990+ . map_err ( InvoiceError :: from)
991+ . and_then ( |invoice| {
992+ #[ cfg( c_bindings) ]
993+ let mut invoice = invoice;
994+ invoice
995+ . sign ( |invoice : & UnsignedBolt12Invoice | {
996+ signer. sign_bolt12_invoice ( invoice)
997+ } )
998+ . map_err ( InvoiceError :: from)
999+ } )
1000+ } ,
10001001 } ;
10011002
10021003 match response {
0 commit comments