@@ -400,6 +400,8 @@ pub struct RouteHop {
400
400
/// If this is the last hop in [`Path::hops`]:
401
401
/// * if we're sending to a [`BlindedPaymentPath`], this is the fee paid for use of the entire
402
402
/// blinded path
403
+ /// * if we're sending to a Trampoline entrypoint, this is the total incoming amount to the
404
+ /// Trampoline hop
403
405
/// * otherwise, this is the full value of this [`Path`]'s part of the payment
404
406
pub fee_msat : u64 ,
405
407
/// The CLTV delta added for this hop.
@@ -485,6 +487,11 @@ pub struct Path {
485
487
/// The list of unblinded hops in this [`Path`]. Must be at least length one.
486
488
pub hops : Vec < RouteHop > ,
487
489
/// 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.
488
495
pub trampoline_hops : Vec < TrampolineHop > ,
489
496
/// The blinded path at which this path terminates, if we're sending to one, and its metadata.
490
497
pub blinded_tail : Option < BlindedTail > ,
@@ -659,6 +666,8 @@ impl Readable for Route {
659
666
660
667
let trampoline_paths: Vec < Vec < TrampolineHop > > = trampoline_paths. unwrap_or ( Vec :: new ( ) ) ;
661
668
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
662
671
if trampoline_paths. len ( ) != paths. len ( ) { return Err ( DecodeError :: InvalidValue ) }
663
672
for ( path, trampoline_hops) in paths. iter_mut ( ) . zip ( trampoline_paths. into_iter ( ) ) {
664
673
path. trampoline_hops = trampoline_hops;
0 commit comments