pub fn find_route<L: Deref, GL: Deref, S: Score>(
    our_node_pubkey: &PublicKey,
    route_params: &RouteParameters,
    network_graph: &NetworkGraph<GL>,
    first_hops: Option<&[&ChannelDetails]>,
    logger: L,
    scorer: &S,
    random_seed_bytes: &[u8; 32]
) -> Result<Route, LightningError> where
    L::Target: Logger,
    GL::Target: Logger
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 params.payee. 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 params.payee.

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.

Note

May be used to re-compute a Route when handling a Event::PaymentPathFailed. Any adjustments to the NetworkGraph and channel scores should be made prior to calling this function.

Panics

Panics if first_hops contains channels without short_channel_ids; ChannelManager::list_usable_channels will never include such channels.