}
impl<'a: 'b, 'b> DirectedChannelInfoWithUpdate<'a, 'b> {
- /// Returns the underlying [`DirectedChannelInfo`].
- pub(super) fn inner(&self) -> &DirectedChannelInfo<'a, 'b> {
- &self.inner
- }
+ /// Returns information for the channel.
+ #[inline]
+ pub(super) fn channel(&self) -> &'a ChannelInfo { &self.inner.channel }
+
+ /// Returns information for the direction.
+ #[inline]
+ pub(super) fn direction(&self) -> &'b ChannelUpdateInfo { self.inner.direction.unwrap() }
+
+ /// Returns the [`EffectiveCapacity`] of the channel in the direction.
+ #[inline]
+ pub(super) fn effective_capacity(&self) -> EffectiveCapacity { self.inner.effective_capacity() }
}
/// The effective capacity of a channel for routing purposes.
fn features(&self) -> ChannelFeatures {
match self {
CandidateRouteHop::FirstHop { details } => details.counterparty.features.to_context(),
- CandidateRouteHop::PublicHop { info, .. } => info.inner().channel().features.clone(),
+ CandidateRouteHop::PublicHop { info, .. } => info.channel().features.clone(),
CandidateRouteHop::PrivateHop { .. } => ChannelFeatures::empty(),
}
}
fn cltv_expiry_delta(&self) -> u32 {
match self {
CandidateRouteHop::FirstHop { .. } => 0,
- CandidateRouteHop::PublicHop { info, .. } => {
- info.inner().direction().unwrap().cltv_expiry_delta as u32
- },
+ CandidateRouteHop::PublicHop { info, .. } => info.direction().cltv_expiry_delta as u32,
CandidateRouteHop::PrivateHop { hint } => hint.cltv_expiry_delta as u32,
}
}
fn htlc_minimum_msat(&self) -> u64 {
match self {
CandidateRouteHop::FirstHop { .. } => 0,
- CandidateRouteHop::PublicHop { info, .. } => {
- info.inner().direction().unwrap().htlc_minimum_msat
- },
+ CandidateRouteHop::PublicHop { info, .. } => info.direction().htlc_minimum_msat,
CandidateRouteHop::PrivateHop { hint } => hint.htlc_minimum_msat.unwrap_or(0),
}
}
CandidateRouteHop::FirstHop { .. } => RoutingFees {
base_msat: 0, proportional_millionths: 0,
},
- CandidateRouteHop::PublicHop { info, .. } => info.inner().direction().unwrap().fees,
+ CandidateRouteHop::PublicHop { info, .. } => info.direction().fees,
CandidateRouteHop::PrivateHop { hint } => hint.fees,
}
}
CandidateRouteHop::FirstHop { details } => EffectiveCapacity::ExactLiquidity {
liquidity_msat: details.outbound_capacity_msat,
},
- CandidateRouteHop::PublicHop { info, .. } => info.inner().effective_capacity(),
+ CandidateRouteHop::PublicHop { info, .. } => info.effective_capacity(),
CandidateRouteHop::PrivateHop { .. } => EffectiveCapacity::Infinite,
}
}