@@ -5631,30 +5631,51 @@ impl<
56315631 ///
56325632 /// LDK will not automatically retry this payment, though it may be manually re-sent after an
56335633 /// [`Event::PaymentFailed`] is generated.
5634- #[rustfmt::skip]
56355634 pub fn send_payment_with_route(
56365635 &self, mut route: Route, payment_hash: PaymentHash, recipient_onion: RecipientOnionFields,
5637- payment_id: PaymentId
5636+ payment_id: PaymentId,
56385637 ) -> Result<(), RetryableSendFailure> {
56395638 let best_block_height = self.best_block.read().unwrap().height;
56405639 let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
56415640 let route_params = route.route_params.clone().unwrap_or_else(|| {
56425641 // Create a dummy route params since they're a required parameter but unused in this case
5643- let (payee_node_id, cltv_delta) = route.paths.first()
5644- .and_then(|path| path.hops.last().map(|hop| (hop.pubkey, hop.cltv_expiry_delta as u32)))
5645- .unwrap_or_else(|| (PublicKey::from_slice(&[2; 33]).unwrap(), MIN_FINAL_CLTV_EXPIRY_DELTA as u32));
5642+ let (payee_node_id, cltv_delta) = route
5643+ .paths
5644+ .first()
5645+ .and_then(|path| {
5646+ path.hops.last().map(|hop| (hop.pubkey, hop.cltv_expiry_delta as u32))
5647+ })
5648+ .unwrap_or_else(|| {
5649+ (PublicKey::from_slice(&[2; 33]).unwrap(), MIN_FINAL_CLTV_EXPIRY_DELTA as u32)
5650+ });
56465651 let dummy_payment_params = PaymentParameters::from_node_id(payee_node_id, cltv_delta);
5647- RouteParameters::from_payment_params_and_value(dummy_payment_params, route.get_total_amount())
5652+ RouteParameters::from_payment_params_and_value(
5653+ dummy_payment_params,
5654+ route.get_total_amount(),
5655+ )
56485656 });
5649- if route.route_params.is_none() { route.route_params = Some(route_params.clone()); }
5657+ if route.route_params.is_none() {
5658+ route.route_params = Some(route_params.clone());
5659+ }
56505660 let router = FixedRouter::new(route);
56515661 let logger =
56525662 WithContext::for_payment(&self.logger, None, None, Some(payment_hash), payment_id);
5653- self.pending_outbound_payments
5654- .send_payment(payment_hash, recipient_onion, payment_id, Retry::Attempts(0),
5655- route_params, &&router, self.list_usable_channels(), || self.compute_inflight_htlcs(),
5656- &self.entropy_source, &self.node_signer, best_block_height,
5657- &self.pending_events, |args| self.send_payment_along_path(args), &logger)
5663+ self.pending_outbound_payments.send_payment(
5664+ payment_hash,
5665+ recipient_onion,
5666+ payment_id,
5667+ Retry::Attempts(0),
5668+ route_params,
5669+ &&router,
5670+ self.list_usable_channels(),
5671+ || self.compute_inflight_htlcs(),
5672+ &self.entropy_source,
5673+ &self.node_signer,
5674+ best_block_height,
5675+ &self.pending_events,
5676+ |args| self.send_payment_along_path(args),
5677+ &logger,
5678+ )
56585679 }
56595680
56605681 /// Sends a payment to the route found using the provided [`RouteParameters`], retrying failed
0 commit comments