X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fmsgs.rs;h=260d39a5a4cefa4e021426b55be37866a6a51127;hb=1cb6d2faf55b33b96214faf03f035ee608d3c289;hp=f0db28949ed7e4aeaf422c4b78de828c04da317c;hpb=0995de7fa85afcbe78bb4f7345f4dd5198dfe94c;p=rust-lightning diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index f0db2894..260d39a5 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -843,6 +843,16 @@ impl SocketAddress { /// This maximum length is reached by a hostname address descriptor: /// a hostname with a maximum length of 255, its 1-byte length and a 2-byte port. pub(crate) const MAX_LEN: u16 = 258; + + pub(crate) fn is_tor(&self) -> bool { + match self { + &SocketAddress::TcpIpV4 {..} => false, + &SocketAddress::TcpIpV6 {..} => false, + &SocketAddress::OnionV2(_) => true, + &SocketAddress::OnionV3 {..} => true, + &SocketAddress::Hostname {..} => false, + } + } } impl Writeable for SocketAddress { @@ -1126,8 +1136,16 @@ pub struct UnsignedNodeAnnouncement { pub alias: NodeAlias, /// List of addresses on which this node is reachable pub addresses: Vec, - pub(crate) excess_address_data: Vec, - pub(crate) excess_data: Vec, + /// Excess address data which was signed as a part of the message which we do not (yet) understand how + /// to decode. + /// + /// This is stored to ensure forward-compatibility as new address types are added to the lightning gossip protocol. + pub excess_address_data: Vec, + /// Excess data which was signed as a part of the message which we do not (yet) understand how + /// to decode. + /// + /// This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. + pub excess_data: Vec, } #[derive(Clone, Debug, Hash, PartialEq, Eq)] /// A [`node_announcement`] message to be sent to or received from a peer.