Skip to content

Commit c5fe496

Browse files
committed
Change cltv_expiry_delta, htlc_minimum_msat, fees and id methods
visibility to public
1 parent 3258fe2 commit c5fe496

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
@@ -1065,7 +1065,8 @@ impl<'a> CandidateRouteHop<'a> {
10651065
}
10661066
}
10671067

1068-
fn cltv_expiry_delta(&self) -> u32 {
1068+
/// Returns cltv_expiry_delta for this hop.
1069+
pub fn cltv_expiry_delta(&self) -> u32 {
10691070
match self {
10701071
CandidateRouteHop::FirstHop { .. } => 0,
10711072
CandidateRouteHop::PublicHop { info, .. } => info.direction().cltv_expiry_delta as u32,
@@ -1075,7 +1076,8 @@ impl<'a> CandidateRouteHop<'a> {
10751076
}
10761077
}
10771078

1078-
fn htlc_minimum_msat(&self) -> u64 {
1079+
/// Returns the htlc_minimum_msat for this hop.
1080+
pub fn htlc_minimum_msat(&self) -> u64 {
10791081
match self {
10801082
CandidateRouteHop::FirstHop { details, .. } => details.next_outbound_htlc_minimum_msat,
10811083
CandidateRouteHop::PublicHop { info, .. } => info.direction().htlc_minimum_msat,
@@ -1085,7 +1087,8 @@ impl<'a> CandidateRouteHop<'a> {
10851087
}
10861088
}
10871089

1088-
fn fees(&self) -> RoutingFees {
1090+
/// Returns the fees for this hop.
1091+
pub fn fees(&self) -> RoutingFees {
10891092
match self {
10901093
CandidateRouteHop::FirstHop { .. } => RoutingFees {
10911094
base_msat: 0, proportional_millionths: 0,
@@ -1119,7 +1122,10 @@ impl<'a> CandidateRouteHop<'a> {
11191122
}
11201123
}
11211124

1122-
fn id(&self, channel_direction: bool /* src_node_id < target_node_id */) -> CandidateHopId {
1125+
/// Returns the id of this hop.
1126+
/// For `Blinded` and `OneHopBlinded` we return `CandidateHopId::Blinded` because we don't know the channel id.
1127+
/// For any other option we return `CandidateHopId::Clear` because we know the channel id and the direction.
1128+
pub fn id(&self, channel_direction: bool /* src_node_id < target_node_id */) -> CandidateHopId {
11231129
match self {
11241130
CandidateRouteHop::Blinded { hint_idx, .. } => CandidateHopId::Blinded(*hint_idx),
11251131
CandidateRouteHop::OneHopBlinded { hint_idx, .. } => CandidateHopId::Blinded(*hint_idx),
@@ -1156,8 +1162,12 @@ impl<'a> CandidateRouteHop<'a> {
11561162
}
11571163
}
11581164

1165+
/// A wrapper around the various hop id representations.
1166+
///
1167+
/// `CandidateHopId::Clear` is used to identify a hop with a known short channel id and direction.
1168+
/// `CandidateHopId::Blinded` is used to identify a blinded hop `hint_idx`.
11591169
#[derive(Clone, Copy, Eq, Hash, Ord, PartialOrd, PartialEq)]
1160-
enum CandidateHopId {
1170+
pub enum CandidateHopId {
11611171
/// Contains (scid, src_node_id < target_node_id)
11621172
Clear((u64, bool)),
11631173
/// Index of the blinded route hint in [`Payee::Blinded::route_hints`].

0 commit comments

Comments
 (0)