Skip to content

Commit 51b4555

Browse files
Minor Route/RouteHop doc updates
1 parent f3b3c43 commit 51b4555

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

lightning/src/routing/router.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ impl Readable for InFlightHtlcs {
212212
}
213213
}
214214

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.
216217
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
217218
pub struct RouteHop {
218219
/// The node_id of the node at this hop.
@@ -226,8 +227,7 @@ pub struct RouteHop {
226227
/// to reach this node.
227228
pub channel_features: ChannelFeatures,
228229
/// 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.
231231
pub fee_msat: u64,
232232
/// The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
233233
/// expected at the destination, in excess of the current block height.
@@ -247,11 +247,11 @@ impl_writeable_tlv_based!(RouteHop, {
247247
/// it can take multiple paths. Each path is composed of one or more hops through the network.
248248
#[derive(Clone, Hash, PartialEq, Eq)]
249249
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.
255255
pub paths: Vec<Vec<RouteHop>>,
256256
/// The `payment_params` parameter passed to [`find_route`].
257257
/// This is used by `ChannelManager` to track information which may be required for retries,
@@ -283,7 +283,8 @@ impl Route {
283283
self.paths.iter().map(|path| path.get_path_fees()).sum()
284284
}
285285

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.
287288
pub fn get_total_amount(&self) -> u64 {
288289
return self.paths.iter()
289290
.map(|path| path.split_last().map(|(hop, _)| hop.fee_msat).unwrap_or(0))

0 commit comments

Comments
 (0)