},
/// A hop found in the [`NetworkGraph`], where the channel capacity may or may not be known.
PublicHop {
- info: DirectedChannelInfoWithUpdate<'a, 'a>,
+ info: DirectedChannelInfoWithUpdate<'a>,
short_channel_id: u64,
},
/// A hop to the payee found in the payment invoice, though not necessarily a direct channel.
}
}
+ // NOTE: This may copy bytes to so avoid calling it in a hot code path.
fn features(&self) -> ChannelFeatures {
match self {
CandidateRouteHop::FirstHop { details } => details.counterparty.features.to_context(),
for chan_id in $node.channels.iter() {
let chan = network_channels.get(chan_id).unwrap();
if !chan.features.requires_unknown_bits() {
- let directed_channel =
+ let (directed_channel, source) =
chan.as_directed_to(&$node_id).expect("inconsistent NetworkGraph");
- let source = directed_channel.source();
- let target = directed_channel.target();
if first_hops.is_none() || *source != our_node_id {
if let Some(direction) = directed_channel.direction() {
if direction.enabled {
info: directed_channel.with_update().unwrap(),
short_channel_id: *chan_id,
};
- add_entry!(candidate, *source, *target, $fee_to_target_msat, $next_hops_value_contribution, $next_hops_path_htlc_minimum_msat, $next_hops_path_penalty_msat, $next_hops_cltv_delta);
+ add_entry!(candidate, *source, $node_id, $fee_to_target_msat, $next_hops_value_contribution, $next_hops_path_htlc_minimum_msat, $next_hops_path_penalty_msat, $next_hops_cltv_delta);
}
}
}
let candidate = network_channels
.get(&hop.short_channel_id)
.and_then(|channel| channel.as_directed_to(&target))
- .and_then(|channel| channel.with_update())
+ .and_then(|(channel, _)| channel.with_update())
.map(|info| CandidateRouteHop::PublicHop {
info,
short_channel_id: hop.short_channel_id,