X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Fevents.rs;h=455263ee26f266046ab171feeefe0859e52e6447;hb=bac1b79fbb000a9cdc615260af2275c97682c2dc;hp=be1979c77c93cfb6739ae01ef2da78ba25e75b75;hpb=5e65c49a82e901527ca6daafd653c24ee15573e7;p=rust-lightning diff --git a/lightning/src/util/events.rs b/lightning/src/util/events.rs index be1979c7..455263ee 100644 --- a/lightning/src/util/events.rs +++ b/lightning/src/util/events.rs @@ -74,7 +74,7 @@ impl_writeable_tlv_based_enum!(PaymentPurpose, (2, SpontaneousPayment) ); -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] /// The reason the channel was closed. See individual variants more details. pub enum ClosureReason { /// Closure generated from receiving a peer error message. @@ -153,7 +153,7 @@ impl_writeable_tlv_based_enum_upgradable!(ClosureReason, ); /// Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`]. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum HTLCDestination { /// We tried forwarding to a channel but failed to do so. An example of such an instance is when /// there is insufficient capacity in our outbound channel. @@ -1137,25 +1137,32 @@ pub enum MessageSendEvent { /// The message which should be sent. msg: msgs::ChannelReestablish, }, + /// Used to send a channel_announcement and channel_update to a specific peer, likely on + /// initial connection to ensure our peers know about our channels. + SendChannelAnnouncement { + /// The node_id of the node which should receive this message + node_id: PublicKey, + /// The channel_announcement which should be sent. + msg: msgs::ChannelAnnouncement, + /// The followup channel_update which should be sent. + update_msg: msgs::ChannelUpdate, + }, /// Used to indicate that a channel_announcement and channel_update should be broadcast to all /// peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2). /// - /// Note that after doing so, you very likely (unless you did so very recently) want to call - /// ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event. - /// This ensures that any nodes which see our channel_announcement also have a relevant + /// Note that after doing so, you very likely (unless you did so very recently) want to + /// broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This + /// ensures that any nodes which see our channel_announcement also have a relevant /// node_announcement, including relevant feature flags which may be important for routing /// through or to us. + /// + /// [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement BroadcastChannelAnnouncement { /// The channel_announcement which should be sent. msg: msgs::ChannelAnnouncement, /// The followup channel_update which should be sent. update_msg: msgs::ChannelUpdate, }, - /// Used to indicate that a node_announcement should be broadcast to all peers. - BroadcastNodeAnnouncement { - /// The node_announcement which should be sent. - msg: msgs::NodeAnnouncement, - }, /// Used to indicate that a channel_update should be broadcast to all peers. BroadcastChannelUpdate { /// The channel_update which should be sent.