@@ -972,22 +972,26 @@ impl OutboundPayments {
972
972
IH : Fn ( ) -> InFlightHtlcs ,
973
973
SP : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError > ,
974
974
{
975
- let ( payment_hash, route_params) =
975
+ let ( payment_hash, keysend_preimage , mut route_params) =
976
976
match self . pending_outbound_payments . lock ( ) . unwrap ( ) . entry ( payment_id) {
977
977
hash_map:: Entry :: Occupied ( entry) => match entry. get ( ) {
978
978
PendingOutboundPayment :: StaticInvoiceReceived {
979
- payment_hash, payment_release_secret : release_secret, route_params, ..
979
+ payment_hash, payment_release_secret : release_secret, keysend_preimage , route_params, ..
980
980
} => {
981
981
if payment_release_secret != * release_secret {
982
982
return Err ( Bolt12PaymentError :: UnexpectedInvoice )
983
983
}
984
- ( * payment_hash, route_params. clone ( ) )
984
+ ( * payment_hash, * keysend_preimage , route_params. clone ( ) )
985
985
} ,
986
986
_ => return Err ( Bolt12PaymentError :: DuplicateInvoice ) ,
987
987
} ,
988
988
hash_map:: Entry :: Vacant ( _) => return Err ( Bolt12PaymentError :: UnexpectedInvoice ) ,
989
989
} ;
990
990
991
+ onion_utils:: set_max_path_length (
992
+ & mut route_params, & RecipientOnionFields :: spontaneous_empty ( ) , Some ( keysend_preimage) , best_block_height
993
+ ) . map_err ( |( ) | Bolt12PaymentError :: SendingFailed ( RetryableSendFailure :: OnionPacketSizeExceeded ) ) ?;
994
+
991
995
self . find_route_and_send_payment (
992
996
payment_hash, payment_id, route_params, router, first_hops, & inflight_htlcs,
993
997
entropy_source, node_signer, best_block_height, logger, pending_events,
0 commit comments