@@ -881,7 +881,7 @@ impl OutboundPayments {
881
881
route_params. max_total_routing_fee_msat = Some ( max_fee_msat) ;
882
882
}
883
883
self . send_payment_for_bolt12_invoice_internal (
884
- payment_id, payment_hash, None , route_params, retry_strategy, router, first_hops,
884
+ payment_id, payment_hash, None , None , route_params, retry_strategy, router, first_hops,
885
885
inflight_htlcs, entropy_source, node_signer, node_id_lookup, secp_ctx, best_block_height,
886
886
logger, pending_events, send_payment_along_path
887
887
)
@@ -891,10 +891,10 @@ impl OutboundPayments {
891
891
R : Deref , ES : Deref , NS : Deref , NL : Deref , IH , SP , L : Deref
892
892
> (
893
893
& self , payment_id : PaymentId , payment_hash : PaymentHash ,
894
- keysend_preimage : Option < PaymentPreimage > , mut route_params : RouteParameters ,
895
- retry_strategy : Retry , router : & R , first_hops : Vec < ChannelDetails > , inflight_htlcs : IH ,
896
- entropy_source : & ES , node_signer : & NS , node_id_lookup : & NL ,
897
- secp_ctx : & Secp256k1 < secp256k1:: All > , best_block_height : u32 , logger : & L ,
894
+ keysend_preimage : Option < PaymentPreimage > , invoice_request : Option < & InvoiceRequest > ,
895
+ mut route_params : RouteParameters , retry_strategy : Retry , router : & R ,
896
+ first_hops : Vec < ChannelDetails > , inflight_htlcs : IH , entropy_source : & ES , node_signer : & NS ,
897
+ node_id_lookup : & NL , secp_ctx : & Secp256k1 < secp256k1:: All > , best_block_height : u32 , logger : & L ,
898
898
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > ,
899
899
send_payment_along_path : SP ,
900
900
) -> Result < ( ) , Bolt12PaymentError >
@@ -952,27 +952,21 @@ impl OutboundPayments {
952
952
payment_hash, recipient_onion. clone ( ) , keysend_preimage, & route, Some ( retry_strategy) ,
953
953
payment_params, entropy_source, best_block_height
954
954
) ;
955
- let mut invoice_request_opt = None ;
956
- let mut outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
957
- match outbounds. entry ( payment_id) {
958
- hash_map:: Entry :: Occupied ( entry) => match entry. remove ( ) {
959
- PendingOutboundPayment :: InvoiceReceived { .. } => {
960
- outbounds. insert ( payment_id, retryable_payment) ;
961
- } ,
962
- PendingOutboundPayment :: StaticInvoiceReceived { invoice_request, .. } => {
963
- invoice_request_opt = Some ( invoice_request) ;
964
- outbounds. insert ( payment_id, retryable_payment) ;
955
+ match self . pending_outbound_payments . lock ( ) . unwrap ( ) . entry ( payment_id) {
956
+ hash_map:: Entry :: Occupied ( entry) => match entry. get ( ) {
957
+ PendingOutboundPayment :: InvoiceReceived { .. }
958
+ | PendingOutboundPayment :: StaticInvoiceReceived { .. } => {
959
+ * entry. into_mut ( ) = retryable_payment;
965
960
} ,
966
961
_ => return Err ( Bolt12PaymentError :: DuplicateInvoice ) ,
967
962
} ,
968
963
hash_map:: Entry :: Vacant ( _) => return Err ( Bolt12PaymentError :: UnexpectedInvoice ) ,
969
964
}
970
- core:: mem:: drop ( outbounds) ;
971
965
972
966
let result = self . pay_route_internal (
973
- & route, payment_hash, & recipient_onion, keysend_preimage, invoice_request_opt . as_ref ( ) ,
974
- payment_id , Some ( route_params. final_value_msat ) , onion_session_privs, node_signer,
975
- best_block_height , & send_payment_along_path
967
+ & route, payment_hash, & recipient_onion, keysend_preimage, invoice_request , payment_id ,
968
+ Some ( route_params. final_value_msat ) , onion_session_privs, node_signer, best_block_height ,
969
+ & send_payment_along_path
976
970
) ;
977
971
log_info ! (
978
972
logger, "Sending payment with id {} and hash {} returned {:?}" , payment_id,
@@ -1088,23 +1082,24 @@ impl OutboundPayments {
1088
1082
IH : Fn ( ) -> InFlightHtlcs ,
1089
1083
SP : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError > ,
1090
1084
{
1091
- let ( payment_hash, keysend_preimage, route_params, retry_strategy) =
1085
+ let ( payment_hash, keysend_preimage, route_params, retry_strategy, invoice_request ) =
1092
1086
match self . pending_outbound_payments . lock ( ) . unwrap ( ) . entry ( payment_id) {
1093
1087
hash_map:: Entry :: Occupied ( entry) => match entry. get ( ) {
1094
1088
PendingOutboundPayment :: StaticInvoiceReceived {
1095
- payment_hash, route_params, retry_strategy, keysend_preimage, ..
1089
+ payment_hash, route_params, retry_strategy, keysend_preimage, invoice_request , ..
1096
1090
} => {
1097
- ( * payment_hash, * keysend_preimage, route_params. clone ( ) , * retry_strategy)
1091
+ ( * payment_hash, * keysend_preimage, route_params. clone ( ) , * retry_strategy,
1092
+ invoice_request. clone ( ) )
1098
1093
} ,
1099
1094
_ => return Err ( Bolt12PaymentError :: DuplicateInvoice ) ,
1100
1095
} ,
1101
1096
hash_map:: Entry :: Vacant ( _) => return Err ( Bolt12PaymentError :: UnexpectedInvoice ) ,
1102
1097
} ;
1103
1098
1104
1099
self . send_payment_for_bolt12_invoice_internal (
1105
- payment_id, payment_hash, Some ( keysend_preimage) , route_params , retry_strategy , router ,
1106
- first_hops , inflight_htlcs , entropy_source , node_signer , node_id_lookup , secp_ctx ,
1107
- best_block_height, logger, pending_events, send_payment_along_path
1100
+ payment_id, payment_hash, Some ( keysend_preimage) , Some ( & invoice_request ) , route_params ,
1101
+ retry_strategy , router , first_hops , inflight_htlcs , entropy_source , node_signer ,
1102
+ node_id_lookup , secp_ctx , best_block_height, logger, pending_events, send_payment_along_path
1108
1103
)
1109
1104
}
1110
1105
0 commit comments