@@ -82,13 +82,21 @@ impl< G: Deref<Target = NetworkGraph<L>>, L: Deref, S: Deref, SP: Sized, Sc: Sco
8282
8383/// A trait defining behavior for routing a payment.
8484pub trait Router {
85- /// Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
85+ /// Finds a [`Route`] for a payment between the given `payer` and a payee.
86+ ///
87+ /// The `payee` and the payment's value are given in [`RouteParameters::payment_params`]
88+ /// and [`RouteParameters::final_value_msat`], respectively.
8689 fn find_route (
8790 & self , payer : & PublicKey , route_params : & RouteParameters ,
8891 first_hops : Option < & [ & ChannelDetails ] > , inflight_htlcs : InFlightHtlcs
8992 ) -> Result < Route , LightningError > ;
90- /// Finds a [`Route`] between `payer` and `payee` for a payment with the given values. Includes
91- /// `PaymentHash` and `PaymentId` to be able to correlate the request with a specific payment.
93+ /// Finds a [`Route`] for a payment between the given `payer` and a payee.
94+ ///
95+ /// The `payee` and the payment's value are given in [`RouteParameters::payment_params`]
96+ /// and [`RouteParameters::final_value_msat`], respectively.
97+ ///
98+ /// Includes a [`PaymentHash`] and a [`PaymentId`] to be able to correlate the request with a specific
99+ /// payment.
92100 fn find_route_with_id (
93101 & self , payer : & PublicKey , route_params : & RouteParameters ,
94102 first_hops : Option < & [ & ChannelDetails ] > , inflight_htlcs : InFlightHtlcs ,
@@ -346,19 +354,17 @@ pub struct Route {
346354 /// [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be
347355 /// the same.
348356 pub paths : Vec < Path > ,
349- /// The `payment_params` parameter passed to [`find_route`].
350- /// This is used by `ChannelManager` to track information which may be required for retries,
351- /// provided back to you via [`Event::PaymentPathFailed`].
357+ /// The `payment_params` parameter passed via [`RouteParameters`] to [`find_route`].
352358 ///
353- /// [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
359+ /// This is used by `ChannelManager` to track information which may be required for retries.
354360 pub payment_params : Option < PaymentParameters > ,
355361}
356362
357363impl Route {
358364 /// Returns the total amount of fees paid on this [`Route`].
359365 ///
360366 /// This doesn't include any extra payment made to the recipient, which can happen in excess of
361- /// the amount passed to [`find_route`]'s `params .final_value_msat`.
367+ /// the amount passed to [`find_route`]'s `route_params .final_value_msat`.
362368 pub fn get_total_fees ( & self ) -> u64 {
363369 self . paths . iter ( ) . map ( |path| path. fee_msat ( ) ) . sum ( )
364370 }
@@ -436,10 +442,7 @@ impl Readable for Route {
436442
437443/// Parameters needed to find a [`Route`].
438444///
439- /// Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
440- /// [`Event::PaymentPathFailed`].
441- ///
442- /// [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
445+ /// Passed to [`find_route`] and [`build_route_from_hops`].
443446#[ derive( Clone , Debug , PartialEq , Eq ) ]
444447pub struct RouteParameters {
445448 /// The parameters of the failed payment path.
@@ -1375,10 +1378,12 @@ fn sort_first_hop_channels(
13751378
13761379/// Finds a route from us (payer) to the given target node (payee).
13771380///
1378- /// If the payee provided features in their invoice, they should be provided via `params.payee`.
1381+ /// If the payee provided features in their invoice, they should be provided via the `payee` field
1382+ /// in the given [`RouteParameters::payment_params`].
13791383/// Without this, MPP will only be used if the payee's features are available in the network graph.
13801384///
1381- /// Private routing paths between a public node and the target may be included in `params.payee`.
1385+ /// Private routing paths between a public node and the target may be included in the `payee` field
1386+ /// of [`RouteParameters::payment_params`].
13821387///
13831388/// If some channels aren't announced, it may be useful to fill in `first_hops` with the results
13841389/// from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
@@ -1388,15 +1393,9 @@ fn sort_first_hop_channels(
13881393/// However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
13891394/// `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
13901395///
1391- /// # Note
1392- ///
1393- /// May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
1394- /// adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
1395- /// function.
1396- ///
13971396/// # Panics
13981397///
1399- /// Panics if first_hops contains channels without short_channel_ids ;
1398+ /// Panics if first_hops contains channels without `short_channel_id`s ;
14001399/// [`ChannelManager::list_usable_channels`] will never include such channels.
14011400///
14021401/// [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
0 commit comments