@@ -399,13 +399,13 @@ pub struct RouteHop {
399
399
/// The fee taken on this hop (for paying for the use of the *next* channel in the path).
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
- /// blinded path
402
+ /// blinded path (including any Trampoline hops)
403
403
/// * otherwise, this is the full value of this [`Path`]'s part of the payment
404
404
pub fee_msat : u64 ,
405
405
/// The CLTV delta added for this hop.
406
406
/// If this is the last hop in [`Path::hops`]:
407
407
/// * if we're sending to a [`BlindedPaymentPath`], this is the CLTV delta for the entire blinded
408
- /// path
408
+ /// path (including any Trampoline hops)
409
409
/// * otherwise, this is the CLTV delta expected at the destination
410
410
pub cltv_expiry_delta : u32 ,
411
411
/// Indicates whether this hop is possibly announced in the public network graph.
@@ -460,6 +460,13 @@ impl_writeable_tlv_based!(TrampolineHop, {
460
460
/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
461
461
#[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
462
462
pub struct BlindedTail {
463
+ /// The list of unblinded Trampoline hops. When using Trampoline, must contain at least one hop.
464
+ ///
465
+ /// Note that the first [`TrampolineHop`] node must also be present as the last [`RouteHop`] node,
466
+ /// where the RouteHop's fee_msat is the total amount received by the first [`TrampolineHop`],
467
+ /// including any blinded path, whereas the [`TrampolineHop`]'s fee_msat is the fee that node
468
+ /// may use to route to the next Trampoline hop and pay itself for the trouble.
469
+ pub trampoline_hops : Vec < TrampolineHop > ,
463
470
/// The hops of the [`BlindedPaymentPath`] provided by the recipient.
464
471
pub hops : Vec < BlindedHop > ,
465
472
/// The blinding point of the [`BlindedPaymentPath`] provided by the recipient.
@@ -476,6 +483,7 @@ impl_writeable_tlv_based!(BlindedTail, {
476
483
( 2 , blinding_point, required) ,
477
484
( 4 , excess_final_cltv_expiry_delta, required) ,
478
485
( 6 , final_value_msat, required) ,
486
+ ( 8 , trampoline_hops, optional_vec) ,
479
487
} ) ;
480
488
481
489
/// A path in a [`Route`] to the payment recipient. Must always be at least length one.
@@ -3404,6 +3412,8 @@ where L::Target: Logger {
3404
3412
if let Some ( blinded_path) = h. candidate . blinded_path ( ) {
3405
3413
final_cltv_delta = h. candidate . cltv_expiry_delta ( ) ;
3406
3414
Some ( BlindedTail {
3415
+ // TODO: fill correctly
3416
+ trampoline_hops : vec ! [ ] ,
3407
3417
hops : blinded_path. blinded_hops ( ) . to_vec ( ) ,
3408
3418
blinding_point : blinded_path. blinding_point ( ) ,
3409
3419
excess_final_cltv_expiry_delta : 0 ,
@@ -7750,6 +7760,7 @@ mod tests {
7750
7760
maybe_announced_channel: true ,
7751
7761
} ] ,
7752
7762
blinded_tail: Some ( BlindedTail {
7763
+ trampoline_hops: vec![ ] ,
7753
7764
hops: vec![
7754
7765
BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 44 ) , encrypted_payload: Vec :: new( ) } ,
7755
7766
BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 45 ) , encrypted_payload: Vec :: new( ) }
@@ -7776,6 +7787,7 @@ mod tests {
7776
7787
7777
7788
// (De)serialize a Route with two paths, each containing a blinded tail.
7778
7789
route. paths [ 1 ] . blinded_tail = Some ( BlindedTail {
7790
+ trampoline_hops : vec ! [ ] ,
7779
7791
hops : vec ! [
7780
7792
BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 48 ) , encrypted_payload: Vec :: new( ) } ,
7781
7793
BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 49 ) , encrypted_payload: Vec :: new( ) }
@@ -7815,6 +7827,7 @@ mod tests {
7815
7827
maybe_announced_channel: false ,
7816
7828
} ] ,
7817
7829
blinded_tail : Some ( BlindedTail {
7830
+ trampoline_hops : vec ! [ ] ,
7818
7831
hops : vec ! [ BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 49 ) , encrypted_payload: Vec :: new( ) } ] ,
7819
7832
blinding_point : ln_test_utils:: pubkey ( 48 ) ,
7820
7833
excess_final_cltv_expiry_delta : 0 ,
@@ -7850,6 +7863,7 @@ mod tests {
7850
7863
}
7851
7864
] ,
7852
7865
blinded_tail: Some ( BlindedTail {
7866
+ trampoline_hops: vec![ ] ,
7853
7867
hops: vec![
7854
7868
BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 45 ) , encrypted_payload: Vec :: new( ) } ,
7855
7869
BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 46 ) , encrypted_payload: Vec :: new( ) }
0 commit comments