Trait MessageRouter

pub trait MessageRouter {
    // Required methods
    fn find_path(
        &self,
        sender: PublicKey,
        peers: Vec<PublicKey>,
        destination: Destination,
    ) -> Result<OnionMessagePath, ()>;
    fn create_blinded_paths<T>(
        &self,
        recipient: PublicKey,
        peers: Vec<PublicKey>,
        secp_ctx: &Secp256k1<T>,
    ) -> Result<Vec<BlindedPath>, ()>
       where T: Signing + Verification;
}
Expand description

A trait defining behavior for routing an OnionMessage.

Required Methods§

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, peers: Vec<PublicKey>, secp_ctx: &Secp256k1<T>, ) -> Result<Vec<BlindedPath>, ()>
where T: Signing + Verification,

Creates BlindedPaths to the recipient node. The nodes in peers are assumed to be direct peers with the recipient.

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<'a> MessageRouter for TestMessageRouter<'a>

§

impl<'a> MessageRouter for TestRouter<'a>

§

impl<G, L, ES> MessageRouter for DefaultMessageRouter<G, L, ES>
where G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: Deref, <L as Deref>::Target: Logger, <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>> + Clone, 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,