@@ -932,22 +932,26 @@ impl OutboundPayments {
932
932
IH : Fn ( ) -> InFlightHtlcs ,
933
933
SP : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError > ,
934
934
{
935
- let ( payment_hash, route_params) =
935
+ let ( payment_hash, keysend_preimage , mut route_params) =
936
936
match self . pending_outbound_payments . lock ( ) . unwrap ( ) . entry ( payment_id) {
937
937
hash_map:: Entry :: Occupied ( entry) => match entry. get ( ) {
938
938
PendingOutboundPayment :: StaticInvoiceReceived {
939
- payment_hash, payment_release_secret : release_secret, route_params, ..
939
+ payment_hash, payment_release_secret : release_secret, keysend_preimage , route_params, ..
940
940
} => {
941
941
if payment_release_secret != * release_secret {
942
942
return Err ( Bolt12PaymentError :: UnexpectedInvoice )
943
943
}
944
- ( * payment_hash, route_params. clone ( ) )
944
+ ( * payment_hash, * keysend_preimage , route_params. clone ( ) )
945
945
} ,
946
946
_ => return Err ( Bolt12PaymentError :: DuplicateInvoice ) ,
947
947
} ,
948
948
hash_map:: Entry :: Vacant ( _) => return Err ( Bolt12PaymentError :: UnexpectedInvoice ) ,
949
949
} ;
950
950
951
+ onion_utils:: set_max_path_length (
952
+ & mut route_params, & RecipientOnionFields :: spontaneous_empty ( ) , Some ( keysend_preimage) , best_block_height
953
+ ) . map_err ( |( ) | Bolt12PaymentError :: OnionPacketSizeExceeded ) ?;
954
+
951
955
self . find_route_and_send_payment (
952
956
payment_hash, payment_id, route_params, router, first_hops, & inflight_htlcs,
953
957
entropy_source, node_signer, best_block_height, logger, pending_events,
0 commit comments