Trait RoutingMessageHandler

Source
pub trait RoutingMessageHandler: BaseMessageHandler {
    // Required methods
    fn handle_node_announcement(
        &self,
        their_node_id: Option<PublicKey>,
        msg: &NodeAnnouncement,
    ) -> Result<bool, LightningError>;
    fn handle_channel_announcement(
        &self,
        their_node_id: Option<PublicKey>,
        msg: &ChannelAnnouncement,
    ) -> Result<bool, LightningError>;
    fn handle_channel_update(
        &self,
        their_node_id: Option<PublicKey>,
        msg: &ChannelUpdate,
    ) -> Result<bool, LightningError>;
    fn get_next_channel_announcement(
        &self,
        starting_point: u64,
    ) -> Option<(ChannelAnnouncement, Option<ChannelUpdate>, Option<ChannelUpdate>)>;
    fn get_next_node_announcement(
        &self,
        starting_point: Option<&NodeId>,
    ) -> Option<NodeAnnouncement>;
    fn handle_reply_channel_range(
        &self,
        their_node_id: PublicKey,
        msg: ReplyChannelRange,
    ) -> Result<(), LightningError>;
    fn handle_reply_short_channel_ids_end(
        &self,
        their_node_id: PublicKey,
        msg: ReplyShortChannelIdsEnd,
    ) -> Result<(), LightningError>;
    fn handle_query_channel_range(
        &self,
        their_node_id: PublicKey,
        msg: QueryChannelRange,
    ) -> Result<(), LightningError>;
    fn handle_query_short_channel_ids(
        &self,
        their_node_id: PublicKey,
        msg: QueryShortChannelIds,
    ) -> Result<(), LightningError>;
    fn processing_queue_high(&self) -> bool;
}
Expand description

A trait to describe an object which can receive routing messages.

§Implementor DoS Warnings

For messages enabled with the gossip_queries feature there are potential DoS vectors when handling inbound queries. Implementors using an on-disk network graph should be aware of repeated disk I/O for queries accessing different parts of the network graph.

Required Methods§

Source

fn handle_node_announcement( &self, their_node_id: Option<PublicKey>, msg: &NodeAnnouncement, ) -> Result<bool, LightningError>

Handle an incoming node_announcement message, returning true if it should be forwarded on, false or returning an Err otherwise.

If their_node_id is None, the message was generated by our own local node.

Source

fn handle_channel_announcement( &self, their_node_id: Option<PublicKey>, msg: &ChannelAnnouncement, ) -> Result<bool, LightningError>

Handle a channel_announcement message, returning true if it should be forwarded on, false or returning an Err otherwise.

If their_node_id is None, the message was generated by our own local node.

Source

fn handle_channel_update( &self, their_node_id: Option<PublicKey>, msg: &ChannelUpdate, ) -> Result<bool, LightningError>

Handle an incoming channel_update message, returning true if it should be forwarded on, false or returning an Err otherwise.

If their_node_id is None, the message was generated by our own local node.

Source

fn get_next_channel_announcement( &self, starting_point: u64, ) -> Option<(ChannelAnnouncement, Option<ChannelUpdate>, Option<ChannelUpdate>)>

Gets channel announcements and updates required to dump our routing table to a remote node, starting at the short_channel_id indicated by starting_point and including announcements for a single channel.

Source

fn get_next_node_announcement( &self, starting_point: Option<&NodeId>, ) -> Option<NodeAnnouncement>

Gets a node announcement required to dump our routing table to a remote node, starting at the node after the provided pubkey and including up to one announcement immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point. If None is provided for starting_point, we start at the first node.

Source

fn handle_reply_channel_range( &self, their_node_id: PublicKey, msg: ReplyChannelRange, ) -> Result<(), LightningError>

Handles the reply of a query we initiated to learn about channels for a given range of blocks. We can expect to receive one or more replies to a single query.

Source

fn handle_reply_short_channel_ids_end( &self, their_node_id: PublicKey, msg: ReplyShortChannelIdsEnd, ) -> Result<(), LightningError>

Handles the reply of a query we initiated asking for routing gossip messages for a list of channels. We should receive this message when a node has completed its best effort to send us the pertaining routing gossip messages.

Source

fn handle_query_channel_range( &self, their_node_id: PublicKey, msg: QueryChannelRange, ) -> Result<(), LightningError>

Handles when a peer asks us to send a list of short_channel_ids for the requested range of blocks.

Source

fn handle_query_short_channel_ids( &self, their_node_id: PublicKey, msg: QueryShortChannelIds, ) -> Result<(), LightningError>

Handles when a peer asks us to send routing gossip messages for a list of short_channel_ids.

Source

fn processing_queue_high(&self) -> bool

Indicates that there are a large number of ChannelAnnouncement (or other) messages pending some async action. While there is no guarantee of the rate of future messages, the caller should seek to reduce the rate of new gossip messages handled, especially ChannelAnnouncements.

Implementors§