@@ -40,9 +40,7 @@ use crate::offers::invoice::{
4040 UnsignedBolt12Invoice , DEFAULT_RELATIVE_EXPIRY ,
4141} ;
4242use crate :: offers:: invoice_error:: InvoiceError ;
43- use crate :: offers:: invoice_request:: {
44- InvoiceRequest , InvoiceRequestBuilder , VerifiedInvoiceRequestLegacy ,
45- } ;
43+ use crate :: offers:: invoice_request:: { InvoiceRequest , InvoiceRequestBuilder , InvoiceSigningInfo } ;
4644use crate :: offers:: nonce:: Nonce ;
4745use crate :: offers:: offer:: { DerivedMetadata , Offer , OfferBuilder } ;
4846use crate :: offers:: parse:: Bolt12SemanticError ;
@@ -406,7 +404,7 @@ fn enqueue_onion_message_with_reply_paths<T: OnionMessageContents + Clone>(
406404pub enum InvreqResponseInstructions {
407405 /// We are the recipient of this payment, and a [`Bolt12Invoice`] should be sent in response to
408406 /// the invoice request since it is now verified.
409- SendInvoice ( VerifiedInvoiceRequestLegacy ) ,
407+ SendInvoice ( InvoiceSigningInfo ) ,
410408 /// We are a static invoice server and should respond to this invoice request by retrieving the
411409 /// [`StaticInvoice`] corresponding to the `recipient_id` and `invoice_id` and calling
412410 /// `OffersMessageFlow::enqueue_static_invoice`.
@@ -920,7 +918,7 @@ where
920918 Ok ( builder. into ( ) )
921919 }
922920
923- /// Creates a response for the provided [`VerifiedInvoiceRequestLegacy `].
921+ /// Creates a response for the provided [`InvoiceSigningInfo `].
924922 ///
925923 /// A response can be either an [`OffersMessage::Invoice`] with additional [`MessageContext`],
926924 /// or an [`OffersMessage::InvoiceError`], depending on the [`InvoiceRequest`].
@@ -929,9 +927,8 @@ where
929927 /// - We fail to generate valid payment paths to include in the [`Bolt12Invoice`].
930928 /// - We fail to generate a valid signed [`Bolt12Invoice`] for the [`InvoiceRequest`].
931929 pub fn create_response_for_invoice_request < ES : Deref , NS : Deref , R : Deref > (
932- & self , signer : & NS , router : & R , entropy_source : ES ,
933- invoice_request : VerifiedInvoiceRequestLegacy , amount_msats : u64 ,
934- payment_hash : PaymentHash , payment_secret : PaymentSecret ,
930+ & self , signer : & NS , router : & R , entropy_source : ES , invoice_request : InvoiceSigningInfo ,
931+ amount_msats : u64 , payment_hash : PaymentHash , payment_secret : PaymentSecret ,
935932 usable_channels : Vec < ChannelDetails > ,
936933 ) -> ( OffersMessage , Option < MessageContext > )
937934 where
@@ -945,7 +942,7 @@ where
945942 let relative_expiry = DEFAULT_RELATIVE_EXPIRY . as_secs ( ) as u32 ;
946943
947944 let context = PaymentContext :: Bolt12Offer ( Bolt12OfferContext {
948- offer_id : invoice_request. offer_id ,
945+ offer_id : invoice_request. offer_id ( ) ,
949946 invoice_request : invoice_request. fields ( ) ,
950947 } ) ;
951948
@@ -968,35 +965,36 @@ where
968965 #[ cfg( not( feature = "std" ) ) ]
969966 let created_at = Duration :: from_secs ( self . highest_seen_timestamp . load ( Ordering :: Acquire ) as u64 ) ;
970967
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- } )
968+ let response = match invoice_request {
969+ InvoiceSigningInfo :: DerivedKeys ( request) => {
970+ #[ cfg( feature = "std" ) ]
971+ let builder = request. respond_using_derived_keys ( payment_paths, payment_hash) ;
972+ #[ cfg( not( feature = "std" ) ) ]
973+ let builder = request. respond_using_derived_keys_no_std ( payment_paths, payment_hash, created_at) ;
974+ builder
975+ . map ( InvoiceBuilder :: < DerivedSigningPubkey > :: from)
976+ . and_then ( |builder| builder. allow_mpp ( ) . build_and_sign ( secp_ctx) )
977+ . map_err ( InvoiceError :: from)
978+ } ,
979+ InvoiceSigningInfo :: ExplicitKeys ( request) => {
980+ #[ cfg( feature = "std" ) ]
981+ let builder = request. respond_with ( payment_paths, payment_hash) ;
982+ #[ cfg( not( feature = "std" ) ) ]
983+ let builder = request. respond_with_no_std ( payment_paths, payment_hash, created_at) ;
984+ builder
985+ . map ( InvoiceBuilder :: < ExplicitSigningPubkey > :: from)
986+ . and_then ( |builder| builder. allow_mpp ( ) . build ( ) )
987+ . map_err ( InvoiceError :: from)
988+ . and_then ( |invoice| {
989+ #[ cfg( c_bindings) ]
990+ let mut invoice = invoice;
991+ invoice
992+ . sign ( |invoice : & UnsignedBolt12Invoice | {
993+ signer. sign_bolt12_invoice ( invoice)
994+ } )
995+ . map_err ( InvoiceError :: from)
996+ } )
997+ } ,
1000998 } ;
1001999
10021000 match response {
0 commit comments