Trait CustomMessageHandler

Source
pub trait CustomMessageHandler: CustomMessageReader {
    // Required methods
    fn handle_custom_message(
        &self,
        msg: Self::CustomMessage,
        sender_node_id: &PublicKey,
    ) -> Result<(), LightningError>;
    fn get_and_clear_pending_msg(&self) -> Vec<(PublicKey, Self::CustomMessage)>;
}
Expand description

Handler for BOLT1-compliant messages.

Required Methods§

Source

fn handle_custom_message( &self, msg: Self::CustomMessage, sender_node_id: &PublicKey, ) -> Result<(), LightningError>

Called with the message type that was received and the buffer to be read. Can return a MessageHandlingError if the message could not be handled.

Source

fn get_and_clear_pending_msg(&self) -> Vec<(PublicKey, Self::CustomMessage)>

Gets the list of pending messages which were generated by the custom message handler, clearing the list in the process. The first tuple element must correspond to the intended recipients node ids. If no connection to one of the specified node does not exist, the message is simply not sent to it.

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§