@@ -399,13 +399,13 @@ pub struct RouteHop {
399399 /// The fee taken on this hop (for paying for the use of the *next* channel in the path).
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
402- /// blinded path
402+ /// blinded path (including any Trampoline hops)
403403 /// * otherwise, this is the full value of this [`Path`]'s part of the payment
404404 pub fee_msat : u64 ,
405405 /// The CLTV delta added for this hop.
406406 /// If this is the last hop in [`Path::hops`]:
407407 /// * if we're sending to a [`BlindedPaymentPath`], this is the CLTV delta for the entire blinded
408- /// path
408+ /// path (including any Trampoline hops)
409409 /// * otherwise, this is the CLTV delta expected at the destination
410410 pub cltv_expiry_delta : u32 ,
411411 /// Indicates whether this hop is possibly announced in the public network graph.
@@ -460,6 +460,12 @@ impl_writeable_tlv_based!(TrampolineHop, {
460460/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
461461#[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
462462pub 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 fee paid for use of the entire blinded path, including
467+ /// any Trampoline hops.
468+ pub trampoline_hops : Vec < TrampolineHop > ,
463469 /// The hops of the [`BlindedPaymentPath`] provided by the recipient.
464470 pub hops : Vec < BlindedHop > ,
465471 /// The blinding point of the [`BlindedPaymentPath`] provided by the recipient.
@@ -476,6 +482,7 @@ impl_writeable_tlv_based!(BlindedTail, {
476482 ( 2 , blinding_point, required) ,
477483 ( 4 , excess_final_cltv_expiry_delta, required) ,
478484 ( 6 , final_value_msat, required) ,
485+ ( 8 , trampoline_hops, optional_vec) ,
479486} ) ;
480487
481488/// A path in a [`Route`] to the payment recipient. Must always be at least length one.
@@ -3404,6 +3411,8 @@ where L::Target: Logger {
34043411 if let Some ( blinded_path) = h. candidate . blinded_path ( ) {
34053412 final_cltv_delta = h. candidate . cltv_expiry_delta ( ) ;
34063413 Some ( BlindedTail {
3414+ // TODO: fill correctly
3415+ trampoline_hops : vec ! [ ] ,
34073416 hops : blinded_path. blinded_hops ( ) . to_vec ( ) ,
34083417 blinding_point : blinded_path. blinding_point ( ) ,
34093418 excess_final_cltv_expiry_delta : 0 ,
@@ -7750,6 +7759,7 @@ mod tests {
77507759 maybe_announced_channel: true ,
77517760 } ] ,
77527761 blinded_tail: Some ( BlindedTail {
7762+ trampoline_hops: vec![ ] ,
77537763 hops: vec![
77547764 BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 44 ) , encrypted_payload: Vec :: new( ) } ,
77557765 BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 45 ) , encrypted_payload: Vec :: new( ) }
@@ -7776,6 +7786,7 @@ mod tests {
77767786
77777787 // (De)serialize a Route with two paths, each containing a blinded tail.
77787788 route. paths [ 1 ] . blinded_tail = Some ( BlindedTail {
7789+ trampoline_hops : vec ! [ ] ,
77797790 hops : vec ! [
77807791 BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 48 ) , encrypted_payload: Vec :: new( ) } ,
77817792 BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 49 ) , encrypted_payload: Vec :: new( ) }
@@ -7815,6 +7826,7 @@ mod tests {
78157826 maybe_announced_channel: false ,
78167827 } ] ,
78177828 blinded_tail : Some ( BlindedTail {
7829+ trampoline_hops : vec ! [ ] ,
78187830 hops : vec ! [ BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 49 ) , encrypted_payload: Vec :: new( ) } ] ,
78197831 blinding_point : ln_test_utils:: pubkey ( 48 ) ,
78207832 excess_final_cltv_expiry_delta : 0 ,
@@ -7850,6 +7862,7 @@ mod tests {
78507862 }
78517863 ] ,
78527864 blinded_tail: Some ( BlindedTail {
7865+ trampoline_hops: vec![ ] ,
78537866 hops: vec![
78547867 BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 45 ) , encrypted_payload: Vec :: new( ) } ,
78557868 BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 46 ) , encrypted_payload: Vec :: new( ) }
0 commit comments