@@ -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.
@@ -460,6 +462,13 @@ impl_writeable_tlv_based!(TrampolineHop, {
460462/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
461463#[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
462464pub struct BlindedTail {
465+ /// The list of unblinded Trampoline hops. When using Trampoline, must contain at least one hop.
466+ ///
467+ /// Note that the first [`TrampolineHop`] node must also be present as the last [`RouteHop`] node,
468+ /// where the RouteHop's fee_msat is the total amount received by the first [`TrampolineHop`],
469+ /// including any blinded path, whereas the [`TrampolineHop`]'s fee_msat is the fee that node
470+ /// may use to route to the next Trampoline hop and pay itself for the trouble.
471+ pub trampoline_hops : Vec < TrampolineHop > ,
463472 /// The hops of the [`BlindedPaymentPath`] provided by the recipient.
464473 pub hops : Vec < BlindedHop > ,
465474 /// The blinding point of the [`BlindedPaymentPath`] provided by the recipient.
@@ -476,6 +485,7 @@ impl_writeable_tlv_based!(BlindedTail, {
476485 ( 2 , blinding_point, required) ,
477486 ( 4 , excess_final_cltv_expiry_delta, required) ,
478487 ( 6 , final_value_msat, required) ,
488+ ( 8 , trampoline_hops, optional_vec) ,
479489} ) ;
480490
481491/// A path in a [`Route`] to the payment recipient. Must always be at least length one.
@@ -3404,6 +3414,8 @@ where L::Target: Logger {
34043414 if let Some ( blinded_path) = h. candidate . blinded_path ( ) {
34053415 final_cltv_delta = h. candidate . cltv_expiry_delta ( ) ;
34063416 Some ( BlindedTail {
3417+ // TODO: fill correctly
3418+ trampoline_hops : vec ! [ ] ,
34073419 hops : blinded_path. blinded_hops ( ) . to_vec ( ) ,
34083420 blinding_point : blinded_path. blinding_point ( ) ,
34093421 excess_final_cltv_expiry_delta : 0 ,
@@ -7750,6 +7762,7 @@ mod tests {
77507762 maybe_announced_channel: true ,
77517763 } ] ,
77527764 blinded_tail: Some ( BlindedTail {
7765+ trampoline_hops: vec![ ] ,
77537766 hops: vec![
77547767 BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 44 ) , encrypted_payload: Vec :: new( ) } ,
77557768 BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 45 ) , encrypted_payload: Vec :: new( ) }
@@ -7776,6 +7789,7 @@ mod tests {
77767789
77777790 // (De)serialize a Route with two paths, each containing a blinded tail.
77787791 route. paths [ 1 ] . blinded_tail = Some ( BlindedTail {
7792+ trampoline_hops : vec ! [ ] ,
77797793 hops : vec ! [
77807794 BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 48 ) , encrypted_payload: Vec :: new( ) } ,
77817795 BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 49 ) , encrypted_payload: Vec :: new( ) }
@@ -7815,6 +7829,7 @@ mod tests {
78157829 maybe_announced_channel: false ,
78167830 } ] ,
78177831 blinded_tail : Some ( BlindedTail {
7832+ trampoline_hops : vec ! [ ] ,
78187833 hops : vec ! [ BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 49 ) , encrypted_payload: Vec :: new( ) } ] ,
78197834 blinding_point : ln_test_utils:: pubkey ( 48 ) ,
78207835 excess_final_cltv_expiry_delta : 0 ,
@@ -7850,6 +7865,7 @@ mod tests {
78507865 }
78517866 ] ,
78527867 blinded_tail: Some ( BlindedTail {
7868+ trampoline_hops: vec![ ] ,
78537869 hops: vec![
78547870 BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 45 ) , encrypted_payload: Vec :: new( ) } ,
78557871 BlindedHop { blinded_node_id: ln_test_utils:: pubkey( 46 ) , encrypted_payload: Vec :: new( ) }
0 commit comments