Function find_route
pub fn find_route<L, GL, S>(
our_node_pubkey: &PublicKey,
route_params: &RouteParameters,
network_graph: &NetworkGraph<GL>,
first_hops: Option<&[&ChannelDetails]>,
logger: L,
scorer: &S,
score_params: &<S as ScoreLookUp>::ScoreParams,
random_seed_bytes: &[u8; 32],
) -> Result<Route, LightningError>
Expand description
Finds a route from us (payer) to the given target node (payee).
If the payee provided features in their invoice, they should be provided via the payee
field
in the given RouteParameters::payment_params
.
Without this, MPP will only be used if the payee’s features are available in the network graph.
Private routing paths between a public node and the target may be included in the payee
field
of RouteParameters::payment_params
.
If some channels aren’t announced, it may be useful to fill in first_hops
with the results
from ChannelManager::list_usable_channels
. If it is filled in, the view of these channels
from network_graph
will be ignored, and only those in first_hops
will be used.
The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
However, the enabled/disabled bit on such channels as well as the htlc_minimum_msat
/
htlc_maximum_msat
are checked as they may change based on the receiving node.
§Panics
Panics if first_hops contains channels without short_channel_id
s;
ChannelManager::list_usable_channels
will never include such channels.