@@ -41,7 +41,7 @@ use crate::offers::invoice::{
4141} ;
4242use crate :: offers:: invoice_error:: InvoiceError ;
4343use crate :: offers:: invoice_request:: {
44- InvoiceRequest , InvoiceRequestBuilder , VerifiedInvoiceRequest ,
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 ( VerifiedInvoiceRequest ) ,
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 [`VerifiedInvoiceRequest `].
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,8 +912,9 @@ 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 : VerifiedInvoiceRequest , amount_msats : u64 , payment_hash : PaymentHash ,
916- payment_secret : PaymentSecret , usable_channels : Vec < ChannelDetails > ,
915+ invoice_request : InvoiceRequestVerifiedFromOffer , amount_msats : u64 ,
916+ payment_hash : PaymentHash , payment_secret : PaymentSecret ,
917+ usable_channels : Vec < ChannelDetails > ,
917918 ) -> ( OffersMessage , Option < MessageContext > )
918919 where
919920 ES :: Target : EntropySource ,
@@ -926,7 +927,7 @@ where
926927 let relative_expiry = DEFAULT_RELATIVE_EXPIRY . as_secs ( ) as u32 ;
927928
928929 let context = PaymentContext :: Bolt12Offer ( Bolt12OfferContext {
929- offer_id : invoice_request. offer_id ,
930+ offer_id : invoice_request. offer_id ( ) ,
930931 invoice_request : invoice_request. fields ( ) ,
931932 } ) ;
932933
@@ -949,35 +950,36 @@ where
949950 #[ cfg( not( feature = "std" ) ) ]
950951 let created_at = Duration :: from_secs ( self . highest_seen_timestamp . load ( Ordering :: Acquire ) as u64 ) ;
951952
952- let response = if invoice_request. keys . is_some ( ) {
953- #[ cfg( feature = "std" ) ]
954- let builder = invoice_request. respond_using_derived_keys ( payment_paths, payment_hash) ;
955- #[ cfg( not( feature = "std" ) ) ]
956- let builder = invoice_request. respond_using_derived_keys_no_std (
957- payment_paths,
958- payment_hash,
959- created_at,
960- ) ;
961- builder
962- . map ( InvoiceBuilder :: < DerivedSigningPubkey > :: from)
963- . and_then ( |builder| builder. allow_mpp ( ) . build_and_sign ( secp_ctx) )
964- . map_err ( InvoiceError :: from)
965- } else {
966- #[ cfg( feature = "std" ) ]
967- let builder = invoice_request. respond_with ( payment_paths, payment_hash) ;
968- #[ cfg( not( feature = "std" ) ) ]
969- let builder = invoice_request. respond_with_no_std ( payment_paths, payment_hash, created_at) ;
970- builder
971- . map ( InvoiceBuilder :: < ExplicitSigningPubkey > :: from)
972- . and_then ( |builder| builder. allow_mpp ( ) . build ( ) )
973- . map_err ( InvoiceError :: from)
974- . and_then ( |invoice| {
975- #[ cfg( c_bindings) ]
976- let mut invoice = invoice;
977- invoice
978- . sign ( |invoice : & UnsignedBolt12Invoice | signer. sign_bolt12_invoice ( invoice) )
979- . map_err ( InvoiceError :: from)
980- } )
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+ } ,
981983 } ;
982984
983985 match response {
0 commit comments