@@ -15,7 +15,8 @@ use bitcoin::secp256k1::{self, Secp256k1, SecretKey};
1515use lightning_invoice:: Bolt11Invoice ;
1616
1717use crate :: blinded_path:: { IntroductionNode , NodeIdLookUp } ;
18- use crate :: events:: { self , PaymentFailureReason } ;
18+ use crate :: events:: { self , PaymentFailureReason , PaidInvoice } ;
19+ use crate :: offers:: static_invoice:: StaticInvoice ;
1920use crate :: types:: payment:: { PaymentHash , PaymentPreimage , PaymentSecret } ;
2021use crate :: ln:: channel_state:: ChannelDetails ;
2122use crate :: ln:: channelmanager:: { EventCompletionAction , HTLCSource , PaymentId } ;
@@ -34,10 +35,7 @@ use crate::util::time::Instant;
3435use crate :: util:: ser:: ReadableArgs ;
3536
3637#[ cfg( async_payments) ]
37- use {
38- crate :: offers:: invoice:: { DerivedSigningPubkey , InvoiceBuilder } ,
39- crate :: offers:: static_invoice:: StaticInvoice ,
40- } ;
38+ use crate :: offers:: invoice:: { DerivedSigningPubkey , InvoiceBuilder } ;
4139
4240use core:: fmt:: { self , Display , Formatter } ;
4341use core:: ops:: Deref ;
@@ -108,7 +106,7 @@ pub(crate) enum PendingOutboundPayment {
108106 invoice_request : Option < InvoiceRequest > ,
109107 // Storing the bolt12 invoice here to allow Proof of Payment after
110108 // the payment is made.
111- bolt12_invoice : Option < Bolt12Invoice > ,
109+ bolt12_invoice : Option < PaidInvoice > ,
112110 custom_tlvs : Vec < ( u64 , Vec < u8 > ) > ,
113111 pending_amt_msat : u64 ,
114112 /// Used to track the fee paid. Present iff the payment was serialized on 0.0.103+.
@@ -158,7 +156,7 @@ impl_writeable_tlv_based!(RetryableInvoiceRequest, {
158156} ) ;
159157
160158impl PendingOutboundPayment {
161- fn bolt12_invoice ( & self ) -> Option < & Bolt12Invoice > {
159+ fn bolt12_invoice ( & self ) -> Option < & PaidInvoice > {
162160 match self {
163161 PendingOutboundPayment :: Retryable { bolt12_invoice, .. } => bolt12_invoice. as_ref ( ) ,
164162 _ => None ,
@@ -967,8 +965,9 @@ impl OutboundPayments {
967965 if let Some ( max_fee_msat) = params_config. max_total_routing_fee_msat {
968966 route_params. max_total_routing_fee_msat = Some ( max_fee_msat) ;
969967 }
968+ let invoice = PaidInvoice :: Bolt12Invoice ( invoice. clone ( ) ) ;
970969 self . send_payment_for_bolt12_invoice_internal (
971- payment_id, payment_hash, None , None , Some ( invoice) , route_params, retry_strategy, router, first_hops,
970+ payment_id, payment_hash, None , None , Some ( & invoice) , route_params, retry_strategy, router, first_hops,
972971 inflight_htlcs, entropy_source, node_signer, node_id_lookup, secp_ctx, best_block_height,
973972 logger, pending_events, send_payment_along_path
974973 )
@@ -979,7 +978,7 @@ impl OutboundPayments {
979978 > (
980979 & self , payment_id : PaymentId , payment_hash : PaymentHash ,
981980 keysend_preimage : Option < PaymentPreimage > , invoice_request : Option < & InvoiceRequest > ,
982- bolt12_invoice : Option < & Bolt12Invoice > ,
981+ bolt12_invoice : Option < & PaidInvoice > ,
983982 mut route_params : RouteParameters , retry_strategy : Retry , router : & R ,
984983 first_hops : Vec < ChannelDetails > , inflight_htlcs : IH , entropy_source : & ES , node_signer : & NS ,
985984 node_id_lookup : & NL , secp_ctx : & Secp256k1 < secp256k1:: All > , best_block_height : u32 , logger : & L ,
@@ -1726,7 +1725,7 @@ impl OutboundPayments {
17261725 & self , payment_hash : PaymentHash , recipient_onion : RecipientOnionFields , payment_id : PaymentId ,
17271726 keysend_preimage : Option < PaymentPreimage > , route : & Route , retry_strategy : Option < Retry > ,
17281727 payment_params : Option < PaymentParameters > , entropy_source : & ES , best_block_height : u32 ,
1729- bolt12_invoice : Option < Bolt12Invoice >
1728+ bolt12_invoice : Option < PaidInvoice >
17301729 ) -> Result < Vec < [ u8 ; 32 ] > , PaymentSendFailure > where ES :: Target : EntropySource {
17311730 let mut pending_outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
17321731 match pending_outbounds. entry ( payment_id) {
@@ -1745,7 +1744,7 @@ impl OutboundPayments {
17451744 fn create_pending_payment < ES : Deref > (
17461745 payment_hash : PaymentHash , recipient_onion : RecipientOnionFields ,
17471746 keysend_preimage : Option < PaymentPreimage > , invoice_request : Option < InvoiceRequest > ,
1748- bolt12_invoice : Option < Bolt12Invoice > , route : & Route , retry_strategy : Option < Retry > ,
1747+ bolt12_invoice : Option < PaidInvoice > , route : & Route , retry_strategy : Option < Retry > ,
17491748 payment_params : Option < PaymentParameters > , entropy_source : & ES , best_block_height : u32
17501749 ) -> ( PendingOutboundPayment , Vec < [ u8 ; 32 ] > )
17511750 where
0 commit comments