@@ -92,6 +92,7 @@ pub(crate) enum PendingOutboundPayment {
9292 retry_strategy : Retry ,
9393 route_params : RouteParameters ,
9494 invoice_request : InvoiceRequest ,
95+ static_invoice : StaticInvoice ,
9596 } ,
9697 Retryable {
9798 retry_strategy : Option < Retry > ,
@@ -1159,6 +1160,7 @@ impl OutboundPayments {
11591160 . take ( )
11601161 . ok_or ( Bolt12PaymentError :: UnexpectedInvoice ) ?
11611162 . invoice_request ,
1163+ static_invoice : invoice. clone ( ) ,
11621164 } ;
11631165 return Ok ( ( ) )
11641166 } ,
@@ -1187,22 +1189,22 @@ impl OutboundPayments {
11871189 IH : Fn ( ) -> InFlightHtlcs ,
11881190 SP : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError > ,
11891191 {
1190- let ( payment_hash, keysend_preimage, route_params, retry_strategy, invoice_request) =
1192+ let ( payment_hash, keysend_preimage, route_params, retry_strategy, invoice_request, invoice ) =
11911193 match self . pending_outbound_payments . lock ( ) . unwrap ( ) . entry ( payment_id) {
11921194 hash_map:: Entry :: Occupied ( entry) => match entry. get ( ) {
11931195 PendingOutboundPayment :: StaticInvoiceReceived {
1194- payment_hash, route_params, retry_strategy, keysend_preimage, invoice_request, ..
1196+ payment_hash, route_params, retry_strategy, keysend_preimage, invoice_request, static_invoice , ..
11951197 } => {
11961198 ( * payment_hash, * keysend_preimage, route_params. clone ( ) , * retry_strategy,
1197- invoice_request. clone ( ) )
1199+ invoice_request. clone ( ) , static_invoice . clone ( ) )
11981200 } ,
11991201 _ => return Err ( Bolt12PaymentError :: DuplicateInvoice ) ,
12001202 } ,
12011203 hash_map:: Entry :: Vacant ( _) => return Err ( Bolt12PaymentError :: UnexpectedInvoice ) ,
12021204 } ;
1203-
1205+ let invoice = PaidInvoice :: StaticInvoice ( invoice ) ;
12041206 self . send_payment_for_bolt12_invoice_internal (
1205- payment_id, payment_hash, Some ( keysend_preimage) , Some ( & invoice_request) , None , route_params,
1207+ payment_id, payment_hash, Some ( keysend_preimage) , Some ( & invoice_request) , Some ( invoice ) , route_params,
12061208 retry_strategy, router, first_hops, inflight_htlcs, entropy_source, node_signer,
12071209 node_id_lookup, secp_ctx, best_block_height, logger, pending_events, send_payment_along_path
12081210 )
@@ -2526,6 +2528,7 @@ impl_writeable_tlv_based_enum_upgradable!(PendingOutboundPayment,
25262528 ( 4 , retry_strategy, required) ,
25272529 ( 6 , route_params, required) ,
25282530 ( 8 , invoice_request, required) ,
2531+ ( 10 , static_invoice, required) ,
25292532 } ,
25302533 // Added in 0.1. Prior versions will drop these outbounds on downgrade, which is safe because
25312534 // no HTLCs are in-flight.
@@ -3156,6 +3159,7 @@ mod tests {
31563159 retry_strategy : Retry :: Attempts ( 0 ) ,
31573160 route_params,
31583161 invoice_request : dummy_invoice_request ( ) ,
3162+ static_invoice : dummy_static_invoice ( ) ,
31593163 } ;
31603164 outbounds. insert ( payment_id, outbound) ;
31613165 core:: mem:: drop ( outbounds) ;
@@ -3203,6 +3207,7 @@ mod tests {
32033207 retry_strategy : Retry :: Attempts ( 0 ) ,
32043208 route_params,
32053209 invoice_request : dummy_invoice_request ( ) ,
3210+ static_invoice : dummy_static_invoice ( ) ,
32063211 } ;
32073212 outbounds. insert ( payment_id, outbound) ;
32083213 core:: mem:: drop ( outbounds) ;
0 commit comments