@@ -212,7 +212,8 @@ impl Readable for InFlightHtlcs {
212
212
}
213
213
}
214
214
215
- /// A hop in a route
215
+ /// A hop in a route, and additional metadata about it. "Hop" is defined as a node and the channel
216
+ /// that leads to it.
216
217
#[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
217
218
pub struct RouteHop {
218
219
/// The node_id of the node at this hop.
@@ -226,8 +227,7 @@ pub struct RouteHop {
226
227
/// to reach this node.
227
228
pub channel_features : ChannelFeatures ,
228
229
/// The fee taken on this hop (for paying for the use of the *next* channel in the path).
229
- /// For the last hop, this should be the full value of the payment (might be more than
230
- /// requested if we had to match htlc_minimum_msat).
230
+ /// For the last hop, this should be the full value of this path's part of the payment.
231
231
pub fee_msat : u64 ,
232
232
/// The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
233
233
/// expected at the destination, in excess of the current block height.
@@ -247,11 +247,11 @@ impl_writeable_tlv_based!(RouteHop, {
247
247
/// it can take multiple paths. Each path is composed of one or more hops through the network.
248
248
#[ derive( Clone , Hash , PartialEq , Eq ) ]
249
249
pub struct Route {
250
- /// The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
251
- /// last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
252
- /// INCLUDING our own, where the last hop is the destination. Thus, this must always be at
253
- /// least length one. While the maximum length of any given path is variable, keeping the length
254
- /// of any path less or equal to 19 should currently ensure it is viable.
250
+ /// The list of paths taken for a single (potentially-)multi-part payment. The pubkey of the
251
+ /// last [` RouteHop`] in each path must be the same. Each entry represents a list of hops, where
252
+ /// the last hop is the destination. Thus, this must always be at least length one. While the
253
+ /// maximum length of any given path is variable, keeping the length of any path less or equal to
254
+ /// 19 should currently ensure it is viable.
255
255
pub paths : Vec < Vec < RouteHop > > ,
256
256
/// The `payment_params` parameter passed to [`find_route`].
257
257
/// This is used by `ChannelManager` to track information which may be required for retries,
@@ -283,7 +283,8 @@ impl Route {
283
283
self . paths . iter ( ) . map ( |path| path. get_path_fees ( ) ) . sum ( )
284
284
}
285
285
286
- /// Returns the total amount paid on this [`Route`], excluding the fees.
286
+ /// Returns the total amount paid on this [`Route`], excluding the fees. Might be more than
287
+ /// requested if we had to reach htlc_minimum_msat.
287
288
pub fn get_total_amount ( & self ) -> u64 {
288
289
return self . paths . iter ( )
289
290
. map ( |path| path. split_last ( ) . map ( |( hop, _) | hop. fee_msat ) . unwrap_or ( 0 ) )
0 commit comments