@@ -982,26 +982,29 @@ impl OutboundPayments {
982982 IH : Fn ( ) -> InFlightHtlcs ,
983983 SP : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError > ,
984984 {
985- let ( payment_hash, keysend_preimage , mut route_params) =
985+ let ( payment_hash, route_params) =
986986 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 ( ) {
988988 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, ..
990991 } => {
991992 if payment_release_secret != * release_secret {
992993 return Err ( Bolt12PaymentError :: UnexpectedInvoice )
993994 }
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 ( ) )
9951002 } ,
9961003 _ => return Err ( Bolt12PaymentError :: DuplicateInvoice ) ,
9971004 } ,
9981005 hash_map:: Entry :: Vacant ( _) => return Err ( Bolt12PaymentError :: UnexpectedInvoice ) ,
9991006 } ;
10001007
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-
10051008 self . find_route_and_send_payment (
10061009 payment_hash, payment_id, route_params, router, first_hops, & inflight_htlcs,
10071010 entropy_source, node_signer, best_block_height, logger, pending_events,
@@ -1096,7 +1099,7 @@ impl OutboundPayments {
10961099 }
10971100
10981101 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
11001103 ) . map_err ( |( ) | RetryableSendFailure :: OnionPacketSizeExceeded ) ?;
11011104
11021105 let mut route = router. find_route_with_id (
0 commit comments