Trait Router
pub trait Router {
// Required method
fn find_route(
&self,
payer: &PublicKey,
route_params: &RouteParameters,
first_hops: Option<&[&ChannelDetails]>,
inflight_htlcs: InFlightHtlcs,
) -> Result<Route, LightningError>;
// Provided method
fn find_route_with_id(
&self,
payer: &PublicKey,
route_params: &RouteParameters,
first_hops: Option<&[&ChannelDetails]>,
inflight_htlcs: InFlightHtlcs,
_payment_hash: PaymentHash,
_payment_id: PaymentId,
) -> Result<Route, LightningError> { ... }
}
Expand description
A trait defining behavior for routing a payment.
Required Methods§
fn find_route(
&self,
payer: &PublicKey,
route_params: &RouteParameters,
first_hops: Option<&[&ChannelDetails]>,
inflight_htlcs: InFlightHtlcs,
) -> Result<Route, LightningError>
fn find_route( &self, payer: &PublicKey, route_params: &RouteParameters, first_hops: Option<&[&ChannelDetails]>, inflight_htlcs: InFlightHtlcs, ) -> Result<Route, LightningError>
Finds a Route
for a payment between the given payer
and a payee.
The payee
and the payment’s value are given in RouteParameters::payment_params
and RouteParameters::final_value_msat
, respectively.
Provided Methods§
fn find_route_with_id(
&self,
payer: &PublicKey,
route_params: &RouteParameters,
first_hops: Option<&[&ChannelDetails]>,
inflight_htlcs: InFlightHtlcs,
_payment_hash: PaymentHash,
_payment_id: PaymentId,
) -> Result<Route, LightningError>
fn find_route_with_id( &self, payer: &PublicKey, route_params: &RouteParameters, first_hops: Option<&[&ChannelDetails]>, inflight_htlcs: InFlightHtlcs, _payment_hash: PaymentHash, _payment_id: PaymentId, ) -> Result<Route, LightningError>
Finds a Route
for a payment between the given payer
and a payee.
The payee
and the payment’s value are given in RouteParameters::payment_params
and RouteParameters::final_value_msat
, respectively.
Includes a PaymentHash
and a PaymentId
to be able to correlate the request with a specific
payment.