@@ -992,26 +992,29 @@ impl OutboundPayments {
992
992
IH : Fn ( ) -> InFlightHtlcs ,
993
993
SP : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError > ,
994
994
{
995
- let ( payment_hash, keysend_preimage , mut route_params) =
995
+ let ( payment_hash, route_params) =
996
996
match self . pending_outbound_payments . lock ( ) . unwrap ( ) . entry ( payment_id) {
997
- hash_map:: Entry :: Occupied ( entry) => match entry. get ( ) {
997
+ hash_map:: Entry :: Occupied ( mut entry) => match entry. get_mut ( ) {
998
998
PendingOutboundPayment :: StaticInvoiceReceived {
999
- payment_hash, payment_release_secret : release_secret, keysend_preimage, route_params, ..
999
+ payment_hash, payment_release_secret : release_secret, keysend_preimage, invoice_request,
1000
+ route_params, ..
1000
1001
} => {
1001
1002
if payment_release_secret != * release_secret {
1002
1003
return Err ( Bolt12PaymentError :: UnexpectedInvoice )
1003
1004
}
1004
- ( * payment_hash, * keysend_preimage, route_params. clone ( ) )
1005
+
1006
+ onion_utils:: set_max_path_length (
1007
+ route_params, & RecipientOnionFields :: spontaneous_empty ( ) ,
1008
+ Some ( * keysend_preimage) , Some ( invoice_request) , best_block_height
1009
+ ) . map_err ( |( ) | Bolt12PaymentError :: SendingFailed ( RetryableSendFailure :: OnionPacketSizeExceeded ) ) ?;
1010
+
1011
+ ( * payment_hash, route_params. clone ( ) )
1005
1012
} ,
1006
1013
_ => return Err ( Bolt12PaymentError :: DuplicateInvoice ) ,
1007
1014
} ,
1008
1015
hash_map:: Entry :: Vacant ( _) => return Err ( Bolt12PaymentError :: UnexpectedInvoice ) ,
1009
1016
} ;
1010
1017
1011
- onion_utils:: set_max_path_length (
1012
- & mut route_params, & RecipientOnionFields :: spontaneous_empty ( ) , Some ( keysend_preimage) , best_block_height
1013
- ) . map_err ( |( ) | Bolt12PaymentError :: SendingFailed ( RetryableSendFailure :: OnionPacketSizeExceeded ) ) ?;
1014
-
1015
1018
self . find_route_and_send_payment (
1016
1019
payment_hash, payment_id, route_params, router, first_hops, & inflight_htlcs,
1017
1020
entropy_source, node_signer, best_block_height, logger, pending_events,
@@ -1106,7 +1109,7 @@ impl OutboundPayments {
1106
1109
}
1107
1110
1108
1111
onion_utils:: set_max_path_length (
1109
- route_params, recipient_onion, keysend_preimage, best_block_height
1112
+ route_params, recipient_onion, keysend_preimage, None , best_block_height
1110
1113
) . map_err ( |( ) | RetryableSendFailure :: OnionPacketSizeExceeded ) ?;
1111
1114
1112
1115
let mut route = router. find_route_with_id (
0 commit comments