@@ -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:: { Amount , DerivedMetadata , Offer , OfferBuilder } ;
@@ -393,7 +393,7 @@ fn enqueue_onion_message_with_reply_paths<T: OnionMessageContents + Clone>(
393
393
pub enum InvreqResponseInstructions {
394
394
/// We are the recipient of this payment, and a [`Bolt12Invoice`] should be sent in response to
395
395
/// the invoice request since it is now verified.
396
- SendInvoice ( VerifiedInvoiceRequestLegacy ) ,
396
+ SendInvoice ( InvoiceRequestVerifiedFromOffer ) ,
397
397
/// We are a static invoice server and should respond to this invoice request by retrieving the
398
398
/// [`StaticInvoice`] corresponding to the `recipient_id` and `invoice_id` and calling
399
399
/// `OffersMessageFlow::enqueue_static_invoice`.
@@ -902,7 +902,7 @@ where
902
902
Ok ( builder. into ( ) )
903
903
}
904
904
905
- /// Creates a response for the provided [`VerifiedInvoiceRequestLegacy `].
905
+ /// Creates a response for the provided [`InvoiceRequestVerifiedFromOffer `].
906
906
///
907
907
/// A response can be either an [`OffersMessage::Invoice`] with additional [`MessageContext`],
908
908
/// or an [`OffersMessage::InvoiceError`], depending on the [`InvoiceRequest`].
@@ -912,7 +912,7 @@ where
912
912
/// - We fail to generate a valid signed [`Bolt12Invoice`] for the [`InvoiceRequest`].
913
913
pub fn create_response_for_invoice_request < ES : Deref , NS : Deref , R : Deref > (
914
914
& self , signer : & NS , router : & R , entropy_source : ES ,
915
- invoice_request : VerifiedInvoiceRequestLegacy , amount_msats : u64 ,
915
+ invoice_request : InvoiceRequestVerifiedFromOffer , amount_msats : u64 ,
916
916
payment_hash : PaymentHash , payment_secret : PaymentSecret ,
917
917
usable_channels : Vec < ChannelDetails > ,
918
918
) -> ( OffersMessage , Option < MessageContext > )
@@ -927,7 +927,7 @@ where
927
927
let relative_expiry = DEFAULT_RELATIVE_EXPIRY . as_secs ( ) as u32 ;
928
928
929
929
let context = PaymentContext :: Bolt12Offer ( Bolt12OfferContext {
930
- offer_id : invoice_request. offer_id ,
930
+ offer_id : invoice_request. offer_id ( ) ,
931
931
invoice_request : invoice_request. fields ( ) ,
932
932
} ) ;
933
933
@@ -950,35 +950,36 @@ where
950
950
#[ cfg( not( feature = "std" ) ) ]
951
951
let created_at = Duration :: from_secs ( self . highest_seen_timestamp . load ( Ordering :: Acquire ) as u64 ) ;
952
952
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
+ } ,
982
983
} ;
983
984
984
985
match response {
0 commit comments