Skip to content

Commit 243bfb1

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 a7b6cb7 commit 243bfb1

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
@@ -1059,7 +1059,11 @@ pub enum CandidateRouteHop<'a> {
10591059
}
10601060

10611061
impl<'a> CandidateRouteHop<'a> {
1062-
fn short_channel_id(&self) -> Option<u64> {
1062+
/// Returns short_channel_id if known.
1063+
/// For `FirstHop` we assume [`ChannelDetails::get_outbound_payment_scid`] is always set, this assumption is checked in
1064+
/// [`find_route`] method.
1065+
/// For `Blinded` and `OneHopBlinded` we return `None` because next hop is not known.
1066+
pub fn short_channel_id(&self) -> Option<u64> {
10631067
match self {
10641068
CandidateRouteHop::FirstHop { details, .. } => Some(details.get_outbound_payment_scid().unwrap()),
10651069
CandidateRouteHop::PublicHop { short_channel_id, .. } => Some(*short_channel_id),
@@ -1080,7 +1084,8 @@ impl<'a> CandidateRouteHop<'a> {
10801084
}
10811085
}
10821086

1083-
fn cltv_expiry_delta(&self) -> u32 {
1087+
/// Returns cltv_expiry_delta for this hop.
1088+
pub fn cltv_expiry_delta(&self) -> u32 {
10841089
match self {
10851090
CandidateRouteHop::FirstHop { .. } => 0,
10861091
CandidateRouteHop::PublicHop { info, .. } => info.direction().cltv_expiry_delta as u32,
@@ -1090,7 +1095,8 @@ impl<'a> CandidateRouteHop<'a> {
10901095
}
10911096
}
10921097

1093-
fn htlc_minimum_msat(&self) -> u64 {
1098+
/// Returns the htlc_minimum_msat for this hop.
1099+
pub fn htlc_minimum_msat(&self) -> u64 {
10941100
match self {
10951101
CandidateRouteHop::FirstHop { details, .. } => details.next_outbound_htlc_minimum_msat,
10961102
CandidateRouteHop::PublicHop { info, .. } => info.direction().htlc_minimum_msat,
@@ -1100,7 +1106,8 @@ impl<'a> CandidateRouteHop<'a> {
11001106
}
11011107
}
11021108

1103-
fn fees(&self) -> RoutingFees {
1109+
/// Returns the fees for this hop.
1110+
pub fn fees(&self) -> RoutingFees {
11041111
match self {
11051112
CandidateRouteHop::FirstHop { .. } => RoutingFees {
11061113
base_msat: 0, proportional_millionths: 0,

0 commit comments

Comments
 (0)