@@ -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 } ;
@@ -403,7 +403,7 @@ fn enqueue_onion_message_with_reply_paths<T: OnionMessageContents + Clone>(
403403pub enum InvreqResponseInstructions {
404404 /// We are the recipient of this payment, and a [`Bolt12Invoice`] should be sent in response to
405405 /// the invoice request since it is now verified.
406- SendInvoice ( VerifiedInvoiceRequest ) ,
406+ SendInvoice ( InvoiceRequestVerifiedFromOffer ) ,
407407 /// We are a static invoice server and should respond to this invoice request by retrieving the
408408 /// [`StaticInvoice`] corresponding to the `recipient_id` and `invoice_slot` and calling
409409 /// [`OffersMessageFlow::enqueue_static_invoice`].
@@ -939,7 +939,7 @@ where
939939 Ok ( builder. into ( ) )
940940 }
941941
942- /// Creates a response for the provided [`VerifiedInvoiceRequest `].
942+ /// Creates a response for the provided [`InvoiceRequestVerifiedFromOffer `].
943943 ///
944944 /// A response can be either an [`OffersMessage::Invoice`] with additional [`MessageContext`],
945945 /// or an [`OffersMessage::InvoiceError`], depending on the [`InvoiceRequest`].
@@ -949,8 +949,9 @@ where
949949 /// - We fail to generate a valid signed [`Bolt12Invoice`] for the [`InvoiceRequest`].
950950 pub fn create_response_for_invoice_request < ES : Deref , NS : Deref , R : Deref > (
951951 & self , signer : & NS , router : & R , entropy_source : ES ,
952- invoice_request : VerifiedInvoiceRequest , amount_msats : u64 , payment_hash : PaymentHash ,
953- payment_secret : PaymentSecret , usable_channels : Vec < ChannelDetails > ,
952+ invoice_request : InvoiceRequestVerifiedFromOffer , amount_msats : u64 ,
953+ payment_hash : PaymentHash , payment_secret : PaymentSecret ,
954+ usable_channels : Vec < ChannelDetails > ,
954955 ) -> ( OffersMessage , Option < MessageContext > )
955956 where
956957 ES :: Target : EntropySource ,
@@ -963,7 +964,7 @@ where
963964 let relative_expiry = DEFAULT_RELATIVE_EXPIRY . as_secs ( ) as u32 ;
964965
965966 let context = PaymentContext :: Bolt12Offer ( Bolt12OfferContext {
966- offer_id : invoice_request. offer_id ,
967+ offer_id : invoice_request. offer_id ( ) ,
967968 invoice_request : invoice_request. fields ( ) ,
968969 } ) ;
969970
@@ -986,35 +987,36 @@ where
986987 #[ cfg( not( feature = "std" ) ) ]
987988 let created_at = Duration :: from_secs ( self . highest_seen_timestamp . load ( Ordering :: Acquire ) as u64 ) ;
988989
989- let response = if invoice_request. keys . is_some ( ) {
990- #[ cfg( feature = "std" ) ]
991- let builder = invoice_request. respond_using_derived_keys ( payment_paths, payment_hash) ;
992- #[ cfg( not( feature = "std" ) ) ]
993- let builder = invoice_request. respond_using_derived_keys_no_std (
994- payment_paths,
995- payment_hash,
996- created_at,
997- ) ;
998- builder
999- . map ( InvoiceBuilder :: < DerivedSigningPubkey > :: from)
1000- . and_then ( |builder| builder. allow_mpp ( ) . build_and_sign ( secp_ctx) )
1001- . map_err ( InvoiceError :: from)
1002- } else {
1003- #[ cfg( feature = "std" ) ]
1004- let builder = invoice_request. respond_with ( payment_paths, payment_hash) ;
1005- #[ cfg( not( feature = "std" ) ) ]
1006- let builder = invoice_request. respond_with_no_std ( payment_paths, payment_hash, created_at) ;
1007- builder
1008- . map ( InvoiceBuilder :: < ExplicitSigningPubkey > :: from)
1009- . and_then ( |builder| builder. allow_mpp ( ) . build ( ) )
1010- . map_err ( InvoiceError :: from)
1011- . and_then ( |invoice| {
1012- #[ cfg( c_bindings) ]
1013- let mut invoice = invoice;
1014- invoice
1015- . sign ( |invoice : & UnsignedBolt12Invoice | signer. sign_bolt12_invoice ( invoice) )
1016- . map_err ( InvoiceError :: from)
1017- } )
990+ let response = match invoice_request {
991+ InvoiceRequestVerifiedFromOffer :: DerivedKeys ( request) => {
992+ #[ cfg( feature = "std" ) ]
993+ let builder = request. respond_using_derived_keys ( payment_paths, payment_hash) ;
994+ #[ cfg( not( feature = "std" ) ) ]
995+ let builder = request. respond_using_derived_keys_no_std ( payment_paths, payment_hash, created_at) ;
996+ builder
997+ . map ( InvoiceBuilder :: < DerivedSigningPubkey > :: from)
998+ . and_then ( |builder| builder. allow_mpp ( ) . build_and_sign ( secp_ctx) )
999+ . map_err ( InvoiceError :: from)
1000+ } ,
1001+ InvoiceRequestVerifiedFromOffer :: ExplicitKeys ( request) => {
1002+ #[ cfg( feature = "std" ) ]
1003+ let builder = request. respond_with ( payment_paths, payment_hash) ;
1004+ #[ cfg( not( feature = "std" ) ) ]
1005+ let builder = request. respond_with_no_std ( payment_paths, payment_hash, created_at) ;
1006+ builder
1007+ . map ( InvoiceBuilder :: < ExplicitSigningPubkey > :: from)
1008+ . and_then ( |builder| builder. allow_mpp ( ) . build ( ) )
1009+ . map_err ( InvoiceError :: from)
1010+ . and_then ( |invoice| {
1011+ #[ cfg( c_bindings) ]
1012+ let mut invoice = invoice;
1013+ invoice
1014+ . sign ( |invoice : & UnsignedBolt12Invoice | {
1015+ signer. sign_bolt12_invoice ( invoice)
1016+ } )
1017+ . map_err ( InvoiceError :: from)
1018+ } )
1019+ } ,
10181020 } ;
10191021
10201022 match response {
0 commit comments