Struct DefaultRouter

Source
pub struct DefaultRouter<G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: Deref, S: Deref, SP: Sized, Sc: ScoreLookUp<ScoreParams = SP>>
where L::Target: Logger, S::Target: for<'a> LockableScore<'a, ScoreLookUp = Sc>, ES::Target: EntropySource,
{ /* private fields */ }
Expand description

A Router implemented using find_route.

§Privacy

Creating BlindedPaymentPaths may affect privacy since, if a suitable path cannot be found, it will create a one-hop path using the recipient as the introduction node if it is a announced node. Otherwise, there is no way to find a path to the introduction node in order to send a payment, and thus an Err is returned.

Implementations§

Source§

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

Source

pub fn new( network_graph: G, logger: L, entropy_source: ES, scorer: S, score_params: SP, ) -> Self

Creates a new router.

Trait Implementations§

Source§

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

Source§

fn find_route( &self, payer: &PublicKey, 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. Read more
Source§

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

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.
Source§

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. Read more

Auto Trait Implementations§

§

impl<G, L, ES, S, SP, Sc> Freeze for DefaultRouter<G, L, ES, S, SP, Sc>
where G: Freeze, L: Freeze, ES: Freeze, S: Freeze, SP: Freeze,

§

impl<G, L, ES, S, SP, Sc> RefUnwindSafe for DefaultRouter<G, L, ES, S, SP, Sc>

§

impl<G, L, ES, S, SP, Sc> Send for DefaultRouter<G, L, ES, S, SP, Sc>
where G: Send, L: Send, ES: Send, S: Send, SP: Send,

§

impl<G, L, ES, S, SP, Sc> Sync for DefaultRouter<G, L, ES, S, SP, Sc>
where G: Sync, L: Sync, ES: Sync, S: Sync, SP: Sync,

§

impl<G, L, ES, S, SP, Sc> Unpin for DefaultRouter<G, L, ES, S, SP, Sc>
where G: Unpin, L: Unpin, ES: Unpin, S: Unpin, SP: Unpin,

§

impl<G, L, ES, S, SP, Sc> UnwindSafe for DefaultRouter<G, L, ES, S, SP, Sc>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.