@@ -41,7 +41,7 @@ use crate::offers::invoice::{
41
41
} ;
42
42
use crate :: offers:: invoice_error:: InvoiceError ;
43
43
use crate :: offers:: invoice_request:: {
44
- InvoiceRequest , InvoiceRequestBuilder , VerifiedInvoiceRequestLegacy ,
44
+ InvoiceRequest , InvoiceRequestBuilder , InvoiceRequestVerifiedFromOffer ,
45
45
} ;
46
46
use crate :: offers:: nonce:: Nonce ;
47
47
use crate :: offers:: offer:: { DerivedMetadata , Offer , OfferBuilder } ;
@@ -406,7 +406,7 @@ fn enqueue_onion_message_with_reply_paths<T: OnionMessageContents + Clone>(
406
406
pub enum InvreqResponseInstructions {
407
407
/// We are the recipient of this payment, and a [`Bolt12Invoice`] should be sent in response to
408
408
/// the invoice request since it is now verified.
409
- SendInvoice ( VerifiedInvoiceRequestLegacy ) ,
409
+ SendInvoice ( InvoiceRequestVerifiedFromOffer ) ,
410
410
/// We are a static invoice server and should respond to this invoice request by retrieving the
411
411
/// [`StaticInvoice`] corresponding to the `recipient_id` and `invoice_id` and calling
412
412
/// `OffersMessageFlow::enqueue_static_invoice`.
@@ -920,7 +920,7 @@ where
920
920
Ok ( builder. into ( ) )
921
921
}
922
922
923
- /// Creates a response for the provided [`VerifiedInvoiceRequestLegacy `].
923
+ /// Creates a response for the provided [`InvoiceRequestVerifiedFromOffer `].
924
924
///
925
925
/// A response can be either an [`OffersMessage::Invoice`] with additional [`MessageContext`],
926
926
/// or an [`OffersMessage::InvoiceError`], depending on the [`InvoiceRequest`].
@@ -930,7 +930,7 @@ where
930
930
/// - We fail to generate a valid signed [`Bolt12Invoice`] for the [`InvoiceRequest`].
931
931
pub fn create_response_for_invoice_request < ES : Deref , NS : Deref , R : Deref > (
932
932
& self , signer : & NS , router : & R , entropy_source : ES ,
933
- invoice_request : VerifiedInvoiceRequestLegacy , amount_msats : u64 ,
933
+ invoice_request : InvoiceRequestVerifiedFromOffer , amount_msats : u64 ,
934
934
payment_hash : PaymentHash , payment_secret : PaymentSecret ,
935
935
usable_channels : Vec < ChannelDetails > ,
936
936
) -> ( OffersMessage , Option < MessageContext > )
@@ -945,7 +945,7 @@ where
945
945
let relative_expiry = DEFAULT_RELATIVE_EXPIRY . as_secs ( ) as u32 ;
946
946
947
947
let context = PaymentContext :: Bolt12Offer ( Bolt12OfferContext {
948
- offer_id : invoice_request. offer_id ,
948
+ offer_id : invoice_request. offer_id ( ) ,
949
949
invoice_request : invoice_request. fields ( ) ,
950
950
} ) ;
951
951
@@ -968,35 +968,36 @@ where
968
968
#[ cfg( not( feature = "std" ) ) ]
969
969
let created_at = Duration :: from_secs ( self . highest_seen_timestamp . load ( Ordering :: Acquire ) as u64 ) ;
970
970
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
+ } ,
1000
1001
} ;
1001
1002
1002
1003
match response {
0 commit comments