pub trait Router: MessageRouter {
// Required methods
fn find_route(
&self,
payer: &PublicKey,
route_params: &RouteParameters,
first_hops: Option<&[&ChannelDetails]>,
inflight_htlcs: InFlightHtlcs
) -> Result<Route, LightningError>;
fn create_blinded_payment_paths<ES: EntropySource + ?Sized, T: Signing + Verification>(
&self,
recipient: PublicKey,
first_hops: Vec<ChannelDetails>,
tlvs: ReceiveTlvs,
amount_msats: u64,
entropy_source: &ES,
secp_ctx: &Secp256k1<T>
) -> Result<Vec<(BlindedPayInfo, BlindedPath)>, ()>;
// 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§
sourcefn 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.
sourcefn create_blinded_payment_paths<ES: EntropySource + ?Sized, T: Signing + Verification>(
&self,
recipient: PublicKey,
first_hops: Vec<ChannelDetails>,
tlvs: ReceiveTlvs,
amount_msats: u64,
entropy_source: &ES,
secp_ctx: &Secp256k1<T>
) -> Result<Vec<(BlindedPayInfo, BlindedPath)>, ()>
fn create_blinded_payment_paths<ES: EntropySource + ?Sized, T: Signing + Verification>( &self, recipient: PublicKey, first_hops: Vec<ChannelDetails>, tlvs: ReceiveTlvs, amount_msats: u64, entropy_source: &ES, secp_ctx: &Secp256k1<T> ) -> Result<Vec<(BlindedPayInfo, BlindedPath)>, ()>
Creates BlindedPath
s for payment to the recipient
node. The channels in first_hops
are assumed to be with the recipient
’s peers. The payment secret and any constraints are
given in tlvs
.
Provided Methods§
sourcefn 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.
Object Safety§
This trait is not object safe.