Skip to content

Commit 278cc83

Browse files
committed
Create TrampolineHop struct
1 parent 21beae7 commit 278cc83

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

lightning/src/routing/router.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,35 @@ 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 fee taken on this hop (for paying for the use of the *next* channel in the path).
401+
/// If this is the last hop in [`Path::hops`]:
402+
/// * if we're sending to a [`BlindedPaymentPath`], this is the fee paid for use of the entire
403+
/// blinded path
404+
/// * otherwise, this is the full value of this [`Path`]'s part of the payment
405+
pub fee_msat: u64,
406+
/// The CLTV delta added for this hop.
407+
/// If this is the last hop in [`Path::hops`]:
408+
/// * if we're sending to a [`BlindedPaymentPath`], this is the CLTV delta for the entire
409+
/// blinded path
410+
/// * otherwise, this is the CLTV delta expected at the destination
411+
pub cltv_expiry_delta: u32,
412+
}
413+
414+
impl_writeable_tlv_based!(TrampolineHop, {
415+
(0, pubkey, required),
416+
(2, node_features, required),
417+
(6, fee_msat, required),
418+
(8, cltv_expiry_delta, required),
419+
});
420+
392421
/// The blinded portion of a [`Path`], if we're routing to a recipient who provided blinded paths in
393422
/// their [`Bolt12Invoice`].
394423
///

0 commit comments

Comments
 (0)