Skip to content

Commit d19a440

Browse files
committed
Change cltv_expiry_delta, htlc_minimum_msat, fees and id methods
visibility to public
1 parent 738f6e1 commit d19a440

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

lightning/src/routing/router.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,8 @@ impl<'a> CandidateRouteHop<'a> {
10581058
}
10591059
}
10601060

1061-
fn cltv_expiry_delta(&self) -> u32 {
1061+
/// Returns cltv_expiry_delta for this hop.
1062+
pub fn cltv_expiry_delta(&self) -> u32 {
10621063
match self {
10631064
CandidateRouteHop::FirstHop { .. } => 0,
10641065
CandidateRouteHop::PublicHop { info, .. } => info.direction().cltv_expiry_delta as u32,
@@ -1068,7 +1069,8 @@ impl<'a> CandidateRouteHop<'a> {
10681069
}
10691070
}
10701071

1071-
fn htlc_minimum_msat(&self) -> u64 {
1072+
/// Returns the htlc_minimum_msat for this hop.
1073+
pub fn htlc_minimum_msat(&self) -> u64 {
10721074
match self {
10731075
CandidateRouteHop::FirstHop { details, .. } => details.next_outbound_htlc_minimum_msat,
10741076
CandidateRouteHop::PublicHop { info, .. } => info.direction().htlc_minimum_msat,
@@ -1078,7 +1080,8 @@ impl<'a> CandidateRouteHop<'a> {
10781080
}
10791081
}
10801082

1081-
fn fees(&self) -> RoutingFees {
1083+
/// Returns the fees for this hop.
1084+
pub fn fees(&self) -> RoutingFees {
10821085
match self {
10831086
CandidateRouteHop::FirstHop { .. } => RoutingFees {
10841087
base_msat: 0, proportional_millionths: 0,
@@ -1112,7 +1115,10 @@ impl<'a> CandidateRouteHop<'a> {
11121115
}
11131116
}
11141117

1115-
fn id(&self, channel_direction: bool /* src_node_id < target_node_id */) -> CandidateHopId {
1118+
/// Returns the id of this hop.
1119+
/// For `Blinded` and `OneHopBlinded` we return `CandidateHopId::Blinded` because we don't know the channel id.
1120+
/// For any other option we return `CandidateHopId::Clear` because we know the channel id and the direction.
1121+
pub fn id(&self, channel_direction: bool /* src_node_id < target_node_id */) -> CandidateHopId {
11161122
match self {
11171123
CandidateRouteHop::Blinded { hint_idx, .. } => CandidateHopId::Blinded(*hint_idx),
11181124
CandidateRouteHop::OneHopBlinded { hint_idx, .. } => CandidateHopId::Blinded(*hint_idx),
@@ -1149,8 +1155,12 @@ impl<'a> CandidateRouteHop<'a> {
11491155
}
11501156
}
11511157

1158+
/// A wrapper around the various hop id representations.
1159+
///
1160+
/// `CandidateHopId::Clear` is used to identify a hop with a known short channel id and direction.
1161+
/// `CandidateHopId::Blinded` is used to identify a blinded hop `hint_idx`.
11521162
#[derive(Clone, Copy, Eq, Hash, Ord, PartialOrd, PartialEq)]
1153-
enum CandidateHopId {
1163+
pub enum CandidateHopId {
11541164
/// Contains (scid, src_node_id < target_node_id)
11551165
Clear((u64, bool)),
11561166
/// Index of the blinded route hint in [`Payee::Blinded::route_hints`].

0 commit comments

Comments
 (0)