X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fmsgs.rs;h=40817aa3c7d5494e6d4340427d666a5a4fe363ed;hb=828c7767463116705559dee367778b4f677476c6;hp=278352845ac7b81cba7d970b013df9c464870457;hpb=7eac8977467c06fb5746cb2ec0789ce1f37e02fa;p=rust-lightning diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index 27835284..40817aa3 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -632,6 +632,25 @@ impl Readable for NetAddress { } } +/// Represents the set of gossip messages that require a signature from a node's identity key. +pub enum UnsignedGossipMessage<'a> { + /// An unsigned channel announcement. + ChannelAnnouncement(&'a UnsignedChannelAnnouncement), + /// An unsigned channel update. + ChannelUpdate(&'a UnsignedChannelUpdate), + /// An unsigned node announcement. + NodeAnnouncement(&'a UnsignedNodeAnnouncement) +} + +impl<'a> Writeable for UnsignedGossipMessage<'a> { + fn write(&self, writer: &mut W) -> Result<(), io::Error> { + match self { + UnsignedGossipMessage::ChannelAnnouncement(ref msg) => msg.write(writer), + UnsignedGossipMessage::ChannelUpdate(ref msg) => msg.write(writer), + UnsignedGossipMessage::NodeAnnouncement(ref msg) => msg.write(writer), + } + } +} /// The unsigned part of a [`node_announcement`] message. /// @@ -814,7 +833,7 @@ pub struct QueryShortChannelIds { pub short_channel_ids: Vec, } -/// A [`reply_short_channel_ids_end message`] is sent as a reply to a +/// A [`reply_short_channel_ids_end`] message is sent as a reply to a /// message. The query recipient makes a best /// effort to respond based on their local network view which may not be /// a perfect view of the network. @@ -934,9 +953,9 @@ pub enum OptionalField { pub trait ChannelMessageHandler : MessageSendEventsProvider { // Channel init: /// Handle an incoming `open_channel` message from the given peer. - fn handle_open_channel(&self, their_node_id: &PublicKey, their_features: InitFeatures, msg: &OpenChannel); + fn handle_open_channel(&self, their_node_id: &PublicKey, msg: &OpenChannel); /// Handle an incoming `accept_channel` message from the given peer. - fn handle_accept_channel(&self, their_node_id: &PublicKey, their_features: InitFeatures, msg: &AcceptChannel); + fn handle_accept_channel(&self, their_node_id: &PublicKey, msg: &AcceptChannel); /// Handle an incoming `funding_created` message from the given peer. fn handle_funding_created(&self, their_node_id: &PublicKey, msg: &FundingCreated); /// Handle an incoming `funding_signed` message from the given peer. @@ -946,7 +965,7 @@ pub trait ChannelMessageHandler : MessageSendEventsProvider { // Channl close: /// Handle an incoming `shutdown` message from the given peer. - fn handle_shutdown(&self, their_node_id: &PublicKey, their_features: &InitFeatures, msg: &Shutdown); + fn handle_shutdown(&self, their_node_id: &PublicKey, msg: &Shutdown); /// Handle an incoming `closing_signed` message from the given peer. fn handle_closing_signed(&self, their_node_id: &PublicKey, msg: &ClosingSigned);