Skip to content

Commit bf56f07

Browse files
committed
f: more Path/TrampolineHop docs
1 parent 101d4ee commit bf56f07

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 entrypoint
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,
492+
/// where the RouteHop's fee_msat is the total amount received by the first [`TrampolineHop`],
493+
/// including any blinded path, whereas the [`TrampolineHop`]'s fee_msat is the fee that node
494+
/// may use to route to the next Trampoline 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>,
@@ -665,6 +672,8 @@ impl Readable for Route {
665672

666673
let trampoline_paths: Vec<Vec<TrampolineHop>> = trampoline_paths.unwrap_or(Vec::new());
667674
if !trampoline_paths.is_empty() {
675+
// if we have serialized Trampoline paths, the number of serialized TrampolineHop
676+
// vectors must match the number of serialized Paths
668677
if trampoline_paths.len() != paths.len() { return Err(DecodeError::InvalidValue) }
669678
for (path, trampoline_hops) in paths.iter_mut().zip(trampoline_paths.into_iter()) {
670679
path.trampoline_hops = trampoline_hops;

0 commit comments

Comments
 (0)