Skip to content

Commit a67b6a2

Browse files
committed
Create TrampolineHop struct
1 parent 39758da commit a67b6a2

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

lightning/src/routing/router.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,41 @@ impl_writeable_tlv_based!(RouteHop, {
389389
(10, cltv_expiry_delta, required),
390390
});
391391

392+
/// A Trampoline hop in a route, and additional metadata about it. "Hop" is defined as a node.
393+
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
394+
pub struct TrampolineHop {
395+
/// The node_id of the node at this hop.
396+
pub pubkey: PublicKey,
397+
/// The node_announcement features of the node at this hop. For the last hop, these may be
398+
/// amended to match the features present in the invoice this node generated.
399+
pub node_features: NodeFeatures,
400+
/// The channel_announcement features of the channel that should be used from the previous hop
401+
/// to reach this node.
402+
pub channel_features: ChannelFeatures,
403+
/// The fee taken on this hop (for paying for the use of the *next* channel in the path).
404+
/// If this is the last hop in [`Path::hops`]:
405+
/// * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path
406+
/// * otherwise, this is the full value of this [`Path`]'s part of the payment
407+
///
408+
/// [`BlindedPath`]: crate::blinded_path::BlindedPath
409+
pub fee_msat: u64,
410+
/// The CLTV delta added for this hop.
411+
/// If this is the last hop in [`Path::hops`]:
412+
/// * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path
413+
/// * otherwise, this is the CLTV delta expected at the destination
414+
///
415+
/// [`BlindedPath`]: crate::blinded_path::BlindedPath
416+
pub cltv_expiry_delta: u32,
417+
}
418+
419+
impl_writeable_tlv_based!(TrampolineHop, {
420+
(0, pubkey, required),
421+
(2, node_features, required),
422+
(6, channel_features, required),
423+
(8, fee_msat, required),
424+
(10, cltv_expiry_delta, required),
425+
});
426+
392427
/// The blinded portion of a [`Path`], if we're routing to a recipient who provided blinded paths in
393428
/// their [`Bolt12Invoice`].
394429
///

0 commit comments

Comments
 (0)