@@ -93,6 +93,7 @@ pub(crate) enum PendingOutboundPayment {
9393 retry_strategy : Retry ,
9494 route_params : RouteParameters ,
9595 invoice_request : InvoiceRequest ,
96+ static_invoice : StaticInvoice ,
9697 } ,
9798 Retryable {
9899 retry_strategy : Option < Retry > ,
@@ -1160,6 +1161,7 @@ impl OutboundPayments {
11601161 . take ( )
11611162 . ok_or ( Bolt12PaymentError :: UnexpectedInvoice ) ?
11621163 . invoice_request ,
1164+ static_invoice : invoice. clone ( ) ,
11631165 } ;
11641166 return Ok ( ( ) )
11651167 } ,
@@ -1188,20 +1190,20 @@ impl OutboundPayments {
11881190 IH : Fn ( ) -> InFlightHtlcs ,
11891191 SP : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError > ,
11901192 {
1191- let ( payment_hash, keysend_preimage, route_params, retry_strategy, invoice_request) =
1193+ let ( payment_hash, keysend_preimage, route_params, retry_strategy, invoice_request, invoice ) =
11921194 match self . pending_outbound_payments . lock ( ) . unwrap ( ) . entry ( payment_id) {
11931195 hash_map:: Entry :: Occupied ( entry) => match entry. get ( ) {
11941196 PendingOutboundPayment :: StaticInvoiceReceived {
1195- payment_hash, route_params, retry_strategy, keysend_preimage, invoice_request, ..
1197+ payment_hash, route_params, retry_strategy, keysend_preimage, invoice_request, static_invoice , ..
11961198 } => {
11971199 ( * payment_hash, * keysend_preimage, route_params. clone ( ) , * retry_strategy,
1198- invoice_request. clone ( ) )
1200+ invoice_request. clone ( ) , static_invoice . clone ( ) )
11991201 } ,
12001202 _ => return Err ( Bolt12PaymentError :: DuplicateInvoice ) ,
12011203 } ,
12021204 hash_map:: Entry :: Vacant ( _) => return Err ( Bolt12PaymentError :: UnexpectedInvoice ) ,
12031205 } ;
1204-
1206+ let invoice = PaidBolt12Invoice :: StaticInvoice ( invoice ) ;
12051207 self . send_payment_for_bolt12_invoice_internal (
12061208 payment_id, payment_hash, Some ( keysend_preimage) , Some ( & invoice_request) , invoice, route_params,
12071209 retry_strategy, router, first_hops, inflight_htlcs, entropy_source, node_signer,
@@ -2527,6 +2529,7 @@ impl_writeable_tlv_based_enum_upgradable!(PendingOutboundPayment,
25272529 ( 4 , retry_strategy, required) ,
25282530 ( 6 , route_params, required) ,
25292531 ( 8 , invoice_request, required) ,
2532+ ( 10 , static_invoice, required) ,
25302533 } ,
25312534 // Added in 0.1. Prior versions will drop these outbounds on downgrade, which is safe because
25322535 // no HTLCs are in-flight.
@@ -3157,6 +3160,7 @@ mod tests {
31573160 retry_strategy : Retry :: Attempts ( 0 ) ,
31583161 route_params,
31593162 invoice_request : dummy_invoice_request ( ) ,
3163+ static_invoice : dummy_static_invoice ( ) ,
31603164 } ;
31613165 outbounds. insert ( payment_id, outbound) ;
31623166 core:: mem:: drop ( outbounds) ;
@@ -3204,6 +3208,7 @@ mod tests {
32043208 retry_strategy : Retry :: Attempts ( 0 ) ,
32053209 route_params,
32063210 invoice_request : dummy_invoice_request ( ) ,
3211+ static_invoice : dummy_static_invoice ( ) ,
32073212 } ;
32083213 outbounds. insert ( payment_id, outbound) ;
32093214 core:: mem:: drop ( outbounds) ;
0 commit comments