breez_sdk_liquid::lightning_125::routing::router

Trait Router

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<T>(
        &self,
        recipient: PublicKey,
        first_hops: Vec<ChannelDetails>,
        tlvs: ReceiveTlvs,
        amount_msats: u64,
        secp_ctx: &Secp256k1<T>,
    ) -> Result<Vec<BlindedPaymentPath>, ()>
       where T: Signing + Verification;

    // 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>

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.

fn create_blinded_payment_paths<T>( &self, recipient: PublicKey, first_hops: Vec<ChannelDetails>, tlvs: ReceiveTlvs, amount_msats: u64, secp_ctx: &Secp256k1<T>, ) -> Result<Vec<BlindedPaymentPath>, ()>
where T: Signing + Verification,

Creates BlindedPaymentPaths 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§

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl<G, L, ES, S, SP, Sc> Router for DefaultRouter<G, L, ES, S, SP, Sc>
where G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: Deref, S: Deref, Sc: ScoreLookUp<ScoreParams = SP>, <L as Deref>::Target: Logger, <S as Deref>::Target: for<'a> LockableScore<'a, ScoreLookUp = Sc>, <ES as Deref>::Target: EntropySource,