breez_sdk_liquid::lightning_125::onion_message::messenger

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

    // Provided method
    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 { ... }
}
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, context: MessageContext, peers: Vec<PublicKey>, secp_ctx: &Secp256k1<T>, ) -> Result<Vec<BlindedMessagePath>, ()>
where T: Signing + Verification,

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

Provided Methods§

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 BlindedMessagePaths to the recipient node. The nodes in peers are assumed to be direct peers with the recipient.

Compact blinded paths use short channel ids instead of pubkeys for a smaller serialization, which is beneficial when a QR code is used to transport the data. The SCID is passed using a MessageForwardNode but may be None for graceful degradation.

Implementations using additional intermediate nodes are responsible for using a MessageForwardNode with Some short channel id, if possible. Similarly, implementations should call BlindedMessagePath::use_compact_introduction_node.

The provided implementation simply delegates to MessageRouter::create_blinded_paths, ignoring the short channel ids.

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