@@ -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:: { Amount , DerivedMetadata , Offer , OfferBuilder } ;
@@ -393,7 +393,7 @@ fn enqueue_onion_message_with_reply_paths<T: OnionMessageContents + Clone>(
393393pub enum InvreqResponseInstructions {
394394 /// We are the recipient of this payment, and a [`Bolt12Invoice`] should be sent in response to
395395 /// the invoice request since it is now verified.
396- SendInvoice ( VerifiedInvoiceRequestLegacy ) ,
396+ SendInvoice ( InvoiceRequestVerifiedFromOffer ) ,
397397 /// We are a static invoice server and should respond to this invoice request by retrieving the
398398 /// [`StaticInvoice`] corresponding to the `recipient_id` and `invoice_id` and calling
399399 /// `OffersMessageFlow::enqueue_static_invoice`.
@@ -902,7 +902,7 @@ where
902902 Ok ( builder. into ( ) )
903903 }
904904
905- /// Creates a response for the provided [`VerifiedInvoiceRequestLegacy `].
905+ /// Creates a response for the provided [`InvoiceRequestVerifiedFromOffer `].
906906 ///
907907 /// A response can be either an [`OffersMessage::Invoice`] with additional [`MessageContext`],
908908 /// or an [`OffersMessage::InvoiceError`], depending on the [`InvoiceRequest`].
@@ -912,7 +912,7 @@ where
912912 /// - We fail to generate a valid signed [`Bolt12Invoice`] for the [`InvoiceRequest`].
913913 pub fn create_response_for_invoice_request < ES : Deref , NS : Deref , R : Deref > (
914914 & self , signer : & NS , router : & R , entropy_source : ES ,
915- invoice_request : VerifiedInvoiceRequestLegacy , amount_msats : u64 ,
915+ invoice_request : InvoiceRequestVerifiedFromOffer , amount_msats : u64 ,
916916 payment_hash : PaymentHash , payment_secret : PaymentSecret ,
917917 usable_channels : Vec < ChannelDetails > ,
918918 ) -> ( OffersMessage , Option < MessageContext > )
@@ -927,7 +927,7 @@ where
927927 let relative_expiry = DEFAULT_RELATIVE_EXPIRY . as_secs ( ) as u32 ;
928928
929929 let context = PaymentContext :: Bolt12Offer ( Bolt12OfferContext {
930- offer_id : invoice_request. offer_id ,
930+ offer_id : invoice_request. offer_id ( ) ,
931931 invoice_request : invoice_request. fields ( ) ,
932932 } ) ;
933933
@@ -950,35 +950,36 @@ where
950950 #[ cfg( not( feature = "std" ) ) ]
951951 let created_at = Duration :: from_secs ( self . highest_seen_timestamp . load ( Ordering :: Acquire ) as u64 ) ;
952952
953- let response = if invoice_request. keys . is_some ( ) {
954- #[ cfg( feature = "std" ) ]
955- let builder = invoice_request. respond_using_derived_keys ( payment_paths, payment_hash) ;
956- #[ cfg( not( feature = "std" ) ) ]
957- let builder = invoice_request. respond_using_derived_keys_no_std (
958- payment_paths,
959- payment_hash,
960- created_at,
961- ) ;
962- builder
963- . map ( InvoiceBuilder :: < DerivedSigningPubkey > :: from)
964- . and_then ( |builder| builder. allow_mpp ( ) . build_and_sign ( secp_ctx) )
965- . map_err ( InvoiceError :: from)
966- } else {
967- #[ cfg( feature = "std" ) ]
968- let builder = invoice_request. respond_with ( payment_paths, payment_hash) ;
969- #[ cfg( not( feature = "std" ) ) ]
970- let builder = invoice_request. respond_with_no_std ( payment_paths, payment_hash, created_at) ;
971- builder
972- . map ( InvoiceBuilder :: < ExplicitSigningPubkey > :: from)
973- . and_then ( |builder| builder. allow_mpp ( ) . build ( ) )
974- . map_err ( InvoiceError :: from)
975- . and_then ( |invoice| {
976- #[ cfg( c_bindings) ]
977- let mut invoice = invoice;
978- invoice
979- . sign ( |invoice : & UnsignedBolt12Invoice | signer. sign_bolt12_invoice ( invoice) )
980- . map_err ( InvoiceError :: from)
981- } )
953+ let response = match invoice_request {
954+ InvoiceRequestVerifiedFromOffer :: DerivedKeys ( request) => {
955+ #[ cfg( feature = "std" ) ]
956+ let builder = request. respond_using_derived_keys ( payment_paths, payment_hash) ;
957+ #[ cfg( not( feature = "std" ) ) ]
958+ let builder = request. respond_using_derived_keys_no_std ( payment_paths, payment_hash, created_at) ;
959+ builder
960+ . map ( InvoiceBuilder :: < DerivedSigningPubkey > :: from)
961+ . and_then ( |builder| builder. allow_mpp ( ) . build_and_sign ( secp_ctx) )
962+ . map_err ( InvoiceError :: from)
963+ } ,
964+ InvoiceRequestVerifiedFromOffer :: ExplicitKeys ( request) => {
965+ #[ cfg( feature = "std" ) ]
966+ let builder = request. respond_with ( payment_paths, payment_hash) ;
967+ #[ cfg( not( feature = "std" ) ) ]
968+ let builder = request. respond_with_no_std ( payment_paths, payment_hash, created_at) ;
969+ builder
970+ . map ( InvoiceBuilder :: < ExplicitSigningPubkey > :: from)
971+ . and_then ( |builder| builder. allow_mpp ( ) . build ( ) )
972+ . map_err ( InvoiceError :: from)
973+ . and_then ( |invoice| {
974+ #[ cfg( c_bindings) ]
975+ let mut invoice = invoice;
976+ invoice
977+ . sign ( |invoice : & UnsignedBolt12Invoice | {
978+ signer. sign_bolt12_invoice ( invoice)
979+ } )
980+ . map_err ( InvoiceError :: from)
981+ } )
982+ } ,
982983 } ;
983984
984985 match response {
0 commit comments