Skip to content

Commit 04e93fc

Browse files
committed
Change CandidateRouteHop functions visbility
Change `short_channel_id`, `cltv_expiry_delta` `fees` and `htlc_minimum_msat` under `CandidateRouteHop` visibility to public and add documentation.
1 parent a1d15ac commit 04e93fc

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lightning/src/routing/router.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,11 @@ pub enum CandidateRouteHop<'a> {
10621062
}
10631063

10641064
impl<'a> CandidateRouteHop<'a> {
1065-
fn short_channel_id(&self) -> Option<u64> {
1065+
/// Returns short_channel_id if known.
1066+
/// For `FirstHop` we assume [`ChannelDetails::get_outbound_payment_scid`] is always set, this assumption is checked in
1067+
/// [`find_route`] method.
1068+
/// For `Blinded` and `OneHopBlinded` we return `None` because next hop is not known.
1069+
pub fn short_channel_id(&self) -> Option<u64> {
10661070
match self {
10671071
CandidateRouteHop::FirstHop { details, .. } => Some(details.get_outbound_payment_scid().unwrap()),
10681072
CandidateRouteHop::PublicHop { short_channel_id, .. } => Some(*short_channel_id),
@@ -1083,7 +1087,8 @@ impl<'a> CandidateRouteHop<'a> {
10831087
}
10841088
}
10851089

1086-
fn cltv_expiry_delta(&self) -> u32 {
1090+
/// Returns cltv_expiry_delta for this hop.
1091+
pub fn cltv_expiry_delta(&self) -> u32 {
10871092
match self {
10881093
CandidateRouteHop::FirstHop { .. } => 0,
10891094
CandidateRouteHop::PublicHop { info, .. } => info.direction().cltv_expiry_delta as u32,
@@ -1093,7 +1098,8 @@ impl<'a> CandidateRouteHop<'a> {
10931098
}
10941099
}
10951100

1096-
fn htlc_minimum_msat(&self) -> u64 {
1101+
/// Returns the htlc_minimum_msat for this hop.
1102+
pub fn htlc_minimum_msat(&self) -> u64 {
10971103
match self {
10981104
CandidateRouteHop::FirstHop { details, .. } => details.next_outbound_htlc_minimum_msat,
10991105
CandidateRouteHop::PublicHop { info, .. } => info.direction().htlc_minimum_msat,
@@ -1103,7 +1109,8 @@ impl<'a> CandidateRouteHop<'a> {
11031109
}
11041110
}
11051111

1106-
fn fees(&self) -> RoutingFees {
1112+
/// Returns the fees for this hop.
1113+
pub fn fees(&self) -> RoutingFees {
11071114
match self {
11081115
CandidateRouteHop::FirstHop { .. } => RoutingFees {
11091116
base_msat: 0, proportional_millionths: 0,

0 commit comments

Comments
 (0)