Skip to content

Commit f10708d

Browse files
committed
Change CandidateRouteHop functions visbility
- Change `short_channel_id` to pub and add docs - Change `cltv_expiry_delta` to pub and add docs - Change `fees` to pub and add docs - Change `htlc_minimum_msat` to pub and add docs
1 parent 192cf1e commit f10708d

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
@@ -1056,7 +1056,11 @@ pub enum CandidateRouteHop<'a> {
10561056
}
10571057

10581058
impl<'a> CandidateRouteHop<'a> {
1059-
fn short_channel_id(&self) -> Option<u64> {
1059+
/// Returns short_channel_id if known.
1060+
/// For `FirstHop` we assume [`ChannelDetails::get_outbound_payment_scid`] is always set, this assumption is checked in
1061+
/// [`find_route`] method.
1062+
/// For `Blinded` and `OneHopBlinded` we return `None` because next hop is not known.
1063+
pub fn short_channel_id(&self) -> Option<u64> {
10601064
match self {
10611065
CandidateRouteHop::FirstHop { details, .. } => Some(details.get_outbound_payment_scid().unwrap()),
10621066
CandidateRouteHop::PublicHop { short_channel_id, .. } => Some(*short_channel_id),
@@ -1077,7 +1081,8 @@ impl<'a> CandidateRouteHop<'a> {
10771081
}
10781082
}
10791083

1080-
fn cltv_expiry_delta(&self) -> u32 {
1084+
/// Returns cltv_expiry_delta for this hop.
1085+
pub fn cltv_expiry_delta(&self) -> u32 {
10811086
match self {
10821087
CandidateRouteHop::FirstHop { .. } => 0,
10831088
CandidateRouteHop::PublicHop { info, .. } => info.direction().cltv_expiry_delta as u32,
@@ -1087,7 +1092,8 @@ impl<'a> CandidateRouteHop<'a> {
10871092
}
10881093
}
10891094

1090-
fn htlc_minimum_msat(&self) -> u64 {
1095+
/// Returns the htlc_minimum_msat for this hop.
1096+
pub fn htlc_minimum_msat(&self) -> u64 {
10911097
match self {
10921098
CandidateRouteHop::FirstHop { details, .. } => details.next_outbound_htlc_minimum_msat,
10931099
CandidateRouteHop::PublicHop { info, .. } => info.direction().htlc_minimum_msat,
@@ -1097,7 +1103,8 @@ impl<'a> CandidateRouteHop<'a> {
10971103
}
10981104
}
10991105

1100-
fn fees(&self) -> RoutingFees {
1106+
/// Returns the fees for this hop.
1107+
pub fn fees(&self) -> RoutingFees {
11011108
match self {
11021109
CandidateRouteHop::FirstHop { .. } => RoutingFees {
11031110
base_msat: 0, proportional_millionths: 0,

0 commit comments

Comments
 (0)