Skip to content

Commit 9e198e1

Browse files
committed
Change cltv_expiry_delta, htlc_minimum_msat, fees and id methods
visibility to public
1 parent 7a7f031 commit 9e198e1

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
@@ -1075,7 +1075,8 @@ impl<'a> CandidateRouteHop<'a> {
10751075
}
10761076
}
10771077

1078-
fn cltv_expiry_delta(&self) -> u32 {
1078+
/// Returns cltv_expiry_delta for this hop.
1079+
pub fn cltv_expiry_delta(&self) -> u32 {
10791080
match self {
10801081
CandidateRouteHop::FirstHop { .. } => 0,
10811082
CandidateRouteHop::PublicHop { info, .. } => info.direction().cltv_expiry_delta as u32,
@@ -1085,7 +1086,8 @@ impl<'a> CandidateRouteHop<'a> {
10851086
}
10861087
}
10871088

1088-
fn htlc_minimum_msat(&self) -> u64 {
1089+
/// Returns the htlc_minimum_msat for this hop.
1090+
pub fn htlc_minimum_msat(&self) -> u64 {
10891091
match self {
10901092
CandidateRouteHop::FirstHop { details, .. } => details.next_outbound_htlc_minimum_msat,
10911093
CandidateRouteHop::PublicHop { info, .. } => info.direction().htlc_minimum_msat,
@@ -1095,7 +1097,8 @@ impl<'a> CandidateRouteHop<'a> {
10951097
}
10961098
}
10971099

1098-
fn fees(&self) -> RoutingFees {
1100+
/// Returns the fees for this hop.
1101+
pub fn fees(&self) -> RoutingFees {
10991102
match self {
11001103
CandidateRouteHop::FirstHop { .. } => RoutingFees {
11011104
base_msat: 0, proportional_millionths: 0,
@@ -1129,7 +1132,10 @@ impl<'a> CandidateRouteHop<'a> {
11291132
}
11301133
}
11311134

1132-
fn id(&self, channel_direction: bool /* src_node_id < target_node_id */) -> CandidateHopId {
1135+
/// Returns the id of this hop.
1136+
/// For `Blinded` and `OneHopBlinded` we return `CandidateHopId::Blinded` because we don't know the channel id.
1137+
/// For any other option we return `CandidateHopId::Clear` because we know the channel id and the direction.
1138+
pub fn id(&self, channel_direction: bool /* src_node_id < target_node_id */) -> CandidateHopId {
11331139
match self {
11341140
CandidateRouteHop::Blinded { hint_idx, .. } => CandidateHopId::Blinded(*hint_idx),
11351141
CandidateRouteHop::OneHopBlinded { hint_idx, .. } => CandidateHopId::Blinded(*hint_idx),
@@ -1166,8 +1172,12 @@ impl<'a> CandidateRouteHop<'a> {
11661172
}
11671173
}
11681174

1175+
/// A wrapper around the various hop id representations.
1176+
///
1177+
/// `CandidateHopId::Clear` is used to identify a hop with a known short channel id and direction.
1178+
/// `CandidateHopId::Blinded` is used to identify a blinded hop `hint_idx`.
11691179
#[derive(Clone, Copy, Eq, Hash, Ord, PartialOrd, PartialEq)]
1170-
enum CandidateHopId {
1180+
pub enum CandidateHopId {
11711181
/// Contains (scid, src_node_id < target_node_id)
11721182
Clear((u64, bool)),
11731183
/// Index of the blinded route hint in [`Payee::Blinded::route_hints`].

0 commit comments

Comments
 (0)