Skip to content

Commit b803fc2

Browse files
committed
f: more Path/TrampolineHop docs
1 parent 12c810d commit b803fc2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lightning/src/routing/router.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,8 @@ pub struct RouteHop {
400400
/// If this is the last hop in [`Path::hops`]:
401401
/// * if we're sending to a [`BlindedPaymentPath`], this is the fee paid for use of the entire
402402
/// blinded path
403+
/// * if we're sending to a Trampoline entrypoint, this is the total incoming amount to the
404+
/// Trampoline hop
403405
/// * otherwise, this is the full value of this [`Path`]'s part of the payment
404406
pub fee_msat: u64,
405407
/// The CLTV delta added for this hop.
@@ -485,6 +487,11 @@ pub struct Path {
485487
/// The list of unblinded hops in this [`Path`]. Must be at least length one.
486488
pub hops: Vec<RouteHop>,
487489
/// The list of unblinded Trampoline hops. When using Trampoline, must contain at least one hop.
490+
///
491+
/// Note that the first TrampolineHop node must also be present as the last RouteHop node, where
492+
/// the RouteHop's fee_msat is the total outgoing amount set to the Trampoline hop, whereas
493+
/// the TrampolineHop's fee_msat is the fee that node may use to route to the next Trampoline
494+
/// hop and pay itself for the trouble.
488495
pub trampoline_hops: Vec<TrampolineHop>,
489496
/// The blinded path at which this path terminates, if we're sending to one, and its metadata.
490497
pub blinded_tail: Option<BlindedTail>,
@@ -659,6 +666,8 @@ impl Readable for Route {
659666

660667
let trampoline_paths: Vec<Vec<TrampolineHop>> = trampoline_paths.unwrap_or(Vec::new());
661668
if !trampoline_paths.is_empty() {
669+
// if we have serialized Trampoline paths, the number of serialized TrampolineHop
670+
// vectors must match the number of serialized Paths
662671
if trampoline_paths.len() != paths.len() { return Err(DecodeError::InvalidValue) }
663672
for (path, trampoline_hops) in paths.iter_mut().zip(trampoline_paths.into_iter()) {
664673
path.trampoline_hops = trampoline_hops;

0 commit comments

Comments
 (0)