@@ -982,26 +982,29 @@ impl OutboundPayments {
982
982
IH : Fn ( ) -> InFlightHtlcs ,
983
983
SP : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError > ,
984
984
{
985
- let ( payment_hash, keysend_preimage , mut route_params) =
985
+ let ( payment_hash, route_params) =
986
986
match self . pending_outbound_payments . lock ( ) . unwrap ( ) . entry ( payment_id) {
987
- hash_map:: Entry :: Occupied ( entry) => match entry. get ( ) {
987
+ hash_map:: Entry :: Occupied ( mut entry) => match entry. get_mut ( ) {
988
988
PendingOutboundPayment :: StaticInvoiceReceived {
989
- payment_hash, payment_release_secret : release_secret, keysend_preimage, route_params, ..
989
+ payment_hash, payment_release_secret : release_secret, keysend_preimage, invoice_request,
990
+ route_params, ..
990
991
} => {
991
992
if payment_release_secret != * release_secret {
992
993
return Err ( Bolt12PaymentError :: UnexpectedInvoice )
993
994
}
994
- ( * payment_hash, * keysend_preimage, route_params. clone ( ) )
995
+
996
+ onion_utils:: set_max_path_length (
997
+ route_params, & RecipientOnionFields :: spontaneous_empty ( ) ,
998
+ Some ( * keysend_preimage) , Some ( invoice_request) , best_block_height
999
+ ) . map_err ( |( ) | Bolt12PaymentError :: SendingFailed ( RetryableSendFailure :: OnionPacketSizeExceeded ) ) ?;
1000
+
1001
+ ( * payment_hash, route_params. clone ( ) )
995
1002
} ,
996
1003
_ => return Err ( Bolt12PaymentError :: DuplicateInvoice ) ,
997
1004
} ,
998
1005
hash_map:: Entry :: Vacant ( _) => return Err ( Bolt12PaymentError :: UnexpectedInvoice ) ,
999
1006
} ;
1000
1007
1001
- onion_utils:: set_max_path_length (
1002
- & mut route_params, & RecipientOnionFields :: spontaneous_empty ( ) , Some ( keysend_preimage) , best_block_height
1003
- ) . map_err ( |( ) | Bolt12PaymentError :: SendingFailed ( RetryableSendFailure :: OnionPacketSizeExceeded ) ) ?;
1004
-
1005
1008
self . find_route_and_send_payment (
1006
1009
payment_hash, payment_id, route_params, router, first_hops, & inflight_htlcs,
1007
1010
entropy_source, node_signer, best_block_height, logger, pending_events,
@@ -1096,7 +1099,7 @@ impl OutboundPayments {
1096
1099
}
1097
1100
1098
1101
onion_utils:: set_max_path_length (
1099
- route_params, recipient_onion, keysend_preimage, best_block_height
1102
+ route_params, recipient_onion, keysend_preimage, None , best_block_height
1100
1103
) . map_err ( |( ) | RetryableSendFailure :: OnionPacketSizeExceeded ) ?;
1101
1104
1102
1105
let mut route = router. find_route_with_id (
0 commit comments