Struct DefaultRouter
pub struct 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,{ /* private fields */ }
Expand description
A Router
implemented using find_route
.
§Privacy
Implements MessageRouter
by delegating to DefaultMessageRouter
. See those docs for
privacy implications.
Implementations§
§impl<G, L, ES, S, SP, Sc> 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,
impl<G, L, ES, S, SP, Sc> 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,
pub fn new(
network_graph: G,
logger: L,
entropy_source: ES,
scorer: S,
score_params: SP,
) -> DefaultRouter<G, L, ES, S, SP, Sc>
pub fn new( network_graph: G, logger: L, entropy_source: ES, scorer: S, score_params: SP, ) -> DefaultRouter<G, L, ES, S, SP, Sc>
Creates a new router.
Trait Implementations§
§impl<G, L, ES, S, SP, Sc> MessageRouter 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,
impl<G, L, ES, S, SP, Sc> MessageRouter 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,
§fn find_path(
&self,
sender: PublicKey,
peers: Vec<PublicKey>,
destination: Destination,
) -> Result<OnionMessagePath, ()>
fn find_path( &self, sender: PublicKey, peers: Vec<PublicKey>, destination: Destination, ) -> Result<OnionMessagePath, ()>
Returns a route for sending an
OnionMessage
to the given Destination
.§fn create_blinded_paths<T>(
&self,
recipient: PublicKey,
context: MessageContext,
peers: Vec<PublicKey>,
secp_ctx: &Secp256k1<T>,
) -> Result<Vec<BlindedMessagePath>, ()>where
T: Signing + Verification,
fn create_blinded_paths<T>(
&self,
recipient: PublicKey,
context: MessageContext,
peers: Vec<PublicKey>,
secp_ctx: &Secp256k1<T>,
) -> Result<Vec<BlindedMessagePath>, ()>where
T: Signing + Verification,
Creates
BlindedMessagePath
s to the recipient
node. The nodes in peers
are assumed to
be direct peers with the recipient
.§fn create_compact_blinded_paths<T>(
&self,
recipient: PublicKey,
context: MessageContext,
peers: Vec<MessageForwardNode>,
secp_ctx: &Secp256k1<T>,
) -> Result<Vec<BlindedMessagePath>, ()>where
T: Signing + Verification,
fn create_compact_blinded_paths<T>(
&self,
recipient: PublicKey,
context: MessageContext,
peers: Vec<MessageForwardNode>,
secp_ctx: &Secp256k1<T>,
) -> Result<Vec<BlindedMessagePath>, ()>where
T: Signing + Verification,
Creates compact
BlindedMessagePath
s to the recipient
node. The nodes in peers
are
assumed to be direct peers with the recipient
. Read more§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,
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,
§fn find_route(
&self,
payer: &PublicKey,
params: &RouteParameters,
first_hops: Option<&[&ChannelDetails]>,
inflight_htlcs: InFlightHtlcs,
) -> Result<Route, LightningError>
fn find_route( &self, payer: &PublicKey, 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,
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
BlindedPaymentPath
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
.§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>
Auto Trait Implementations§
impl<G, L, ES, S, SP, Sc> Freeze for DefaultRouter<G, L, ES, S, SP, Sc>
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>
impl<G, L, ES, S, SP, Sc> Sync for DefaultRouter<G, L, ES, S, SP, Sc>
impl<G, L, ES, S, SP, Sc> Unpin for DefaultRouter<G, L, ES, S, SP, Sc>
impl<G, L, ES, S, SP, Sc> UnwindSafe for DefaultRouter<G, L, ES, S, SP, Sc>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request