Skip to content

Commit fb5a3f0

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 0fb3581 commit fb5a3f0

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
@@ -1066,7 +1066,11 @@ pub enum CandidateRouteHop<'a> {
10661066
}
10671067

10681068
impl<'a> CandidateRouteHop<'a> {
1069-
fn short_channel_id(&self) -> Option<u64> {
1069+
/// Returns short_channel_id if known.
1070+
/// For `FirstHop` we assume [`ChannelDetails::get_outbound_payment_scid`] is always set, this assumption is checked in
1071+
/// [`find_route`] method.
1072+
/// For `Blinded` and `OneHopBlinded` we return `None` because next hop is not known.
1073+
pub fn short_channel_id(&self) -> Option<u64> {
10701074
match self {
10711075
CandidateRouteHop::FirstHop { details, .. } => Some(details.get_outbound_payment_scid().unwrap()),
10721076
CandidateRouteHop::PublicHop { short_channel_id, .. } => Some(*short_channel_id),
@@ -1087,7 +1091,8 @@ impl<'a> CandidateRouteHop<'a> {
10871091
}
10881092
}
10891093

1090-
fn cltv_expiry_delta(&self) -> u32 {
1094+
/// Returns cltv_expiry_delta for this hop.
1095+
pub fn cltv_expiry_delta(&self) -> u32 {
10911096
match self {
10921097
CandidateRouteHop::FirstHop { .. } => 0,
10931098
CandidateRouteHop::PublicHop { info, .. } => info.direction().cltv_expiry_delta as u32,
@@ -1097,7 +1102,8 @@ impl<'a> CandidateRouteHop<'a> {
10971102
}
10981103
}
10991104

1100-
fn htlc_minimum_msat(&self) -> u64 {
1105+
/// Returns the htlc_minimum_msat for this hop.
1106+
pub fn htlc_minimum_msat(&self) -> u64 {
11011107
match self {
11021108
CandidateRouteHop::FirstHop { details, .. } => details.next_outbound_htlc_minimum_msat,
11031109
CandidateRouteHop::PublicHop { info, .. } => info.direction().htlc_minimum_msat,
@@ -1107,7 +1113,8 @@ impl<'a> CandidateRouteHop<'a> {
11071113
}
11081114
}
11091115

1110-
fn fees(&self) -> RoutingFees {
1116+
/// Returns the fees for this hop.
1117+
pub fn fees(&self) -> RoutingFees {
11111118
match self {
11121119
CandidateRouteHop::FirstHop { .. } => RoutingFees {
11131120
base_msat: 0, proportional_millionths: 0,

0 commit comments

Comments
 (0)