X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fmsgs.rs;h=6e49a46f08a02a25065652e28cf3895afc031fe8;hb=36834b3cef4ec65b73f7fff06941768f5d761b52;hp=c971df906c281fc96fd852c483def81367618ee2;hpb=56146e740f55b05bdb6de3b64f33d090227ab093;p=rust-lightning diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index c971df90..6e49a46f 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -993,21 +993,15 @@ pub trait ChannelMessageHandler : MessageSendEventsProvider { fn handle_announcement_signatures(&self, their_node_id: &PublicKey, msg: &AnnouncementSignatures); // Connection loss/reestablish: - /// Indicates a connection to the peer failed/an existing connection was lost. If no connection - /// is believed to be possible in the future (eg they're sending us messages we don't - /// understand or indicate they require unknown feature bits), `no_connection_possible` is set - /// and any outstanding channels should be failed. - /// - /// Note that in some rare cases this may be called without a corresponding - /// [`Self::peer_connected`]. - fn peer_disconnected(&self, their_node_id: &PublicKey, no_connection_possible: bool); + /// Indicates a connection to the peer failed/an existing connection was lost. + fn peer_disconnected(&self, their_node_id: &PublicKey); /// Handle a peer reconnecting, possibly generating `channel_reestablish` message(s). /// /// May return an `Err(())` if the features the peer supports are not sufficient to communicate /// with us. Implementors should be somewhat conservative about doing so, however, as other /// message handlers may still wish to communicate with this peer. - fn peer_connected(&self, their_node_id: &PublicKey, msg: &Init) -> Result<(), ()>; + fn peer_connected(&self, their_node_id: &PublicKey, msg: &Init, inbound: bool) -> Result<(), ()>; /// Handle an incoming `channel_reestablish` message from the given peer. fn handle_channel_reestablish(&self, their_node_id: &PublicKey, msg: &ChannelReestablish); @@ -1065,7 +1059,7 @@ pub trait RoutingMessageHandler : MessageSendEventsProvider { /// May return an `Err(())` if the features the peer supports are not sufficient to communicate /// with us. Implementors should be somewhat conservative about doing so, however, as other /// message handlers may still wish to communicate with this peer. - fn peer_connected(&self, their_node_id: &PublicKey, init: &Init) -> Result<(), ()>; + fn peer_connected(&self, their_node_id: &PublicKey, init: &Init, inbound: bool) -> Result<(), ()>; /// 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. @@ -1082,6 +1076,13 @@ pub trait RoutingMessageHandler : MessageSendEventsProvider { /// list of `short_channel_id`s. fn handle_query_short_channel_ids(&self, their_node_id: &PublicKey, msg: QueryShortChannelIds) -> Result<(), LightningError>; + // Handler queueing status: + /// 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 + /// [`ChannelAnnouncement`]s. + fn processing_queue_high(&self) -> bool; + // Handler information: /// Gets the node feature flags which this handler itself supports. All available handlers are /// queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] @@ -1105,13 +1106,10 @@ pub trait OnionMessageHandler : OnionMessageProvider { /// May return an `Err(())` if the features the peer supports are not sufficient to communicate /// with us. Implementors should be somewhat conservative about doing so, however, as other /// message handlers may still wish to communicate with this peer. - fn peer_connected(&self, their_node_id: &PublicKey, init: &Init) -> Result<(), ()>; + fn peer_connected(&self, their_node_id: &PublicKey, init: &Init, inbound: bool) -> Result<(), ()>; /// Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to /// drop and refuse to forward onion messages to this peer. - /// - /// Note that in some rare cases this may be called without a corresponding - /// [`Self::peer_connected`]. - fn peer_disconnected(&self, their_node_id: &PublicKey, no_connection_possible: bool); + fn peer_disconnected(&self, their_node_id: &PublicKey); // Handler information: /// Gets the node feature flags which this handler itself supports. All available handlers are