Skip to content

Commit 75cf8d2

Browse files
committed
Introduce TrampolineHop struct
To define the hops in a Path that are meant as Trampoline hops, we need to introduce a new hop type much alike `RouteHop`, except these hops would not be defined by channel ID used to route payments. Instead, the preceding Trampoline hop would determine its own optimal path to route the payment onwards.
1 parent 31b32c5 commit 75cf8d2

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

lightning/src/routing/router.rs

+25
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,31 @@ impl_writeable_tlv_based!(RouteHop, {
429429
(10, cltv_expiry_delta, required),
430430
});
431431

432+
/// A Trampoline hop in a route, and additional metadata about it. "Hop" is defined as a node.
433+
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
434+
pub struct TrampolineHop {
435+
/// The node_id of the node at this hop.
436+
pub pubkey: PublicKey,
437+
/// The node_announcement features of the node at this hop.
438+
pub node_features: NodeFeatures,
439+
/// The fee this hop should use to pay for routing towards the next Trampoline hop, or to the
440+
/// recipient if this is the last Trampoline hop.
441+
/// If this is the last Trampoline hop within [`BlindedTail`], this is the fee paid for the use of
442+
/// the entire blinded path.
443+
pub fee_msat: u64,
444+
/// The CLTV delta added for this hop.
445+
/// If this is the last Trampoline hop within [`BlindedTail`], this is the CLTV delta for the entire
446+
/// blinded path.
447+
pub cltv_expiry_delta: u32,
448+
}
449+
450+
impl_writeable_tlv_based!(TrampolineHop, {
451+
(0, pubkey, required),
452+
(2, node_features, required),
453+
(4, fee_msat, required),
454+
(6, cltv_expiry_delta, required),
455+
});
456+
432457
/// The blinded portion of a [`Path`], if we're routing to a recipient who provided blinded paths in
433458
/// their [`Bolt12Invoice`].
434459
///

0 commit comments

Comments
 (0)