projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Convert COMMITMENT_TX_BASE_WEIGHT to anchor-aware function
[rust-lightning]
/
lightning
/
src
/
ln
/
msgs.rs
diff --git
a/lightning/src/ln/msgs.rs
b/lightning/src/ln/msgs.rs
index 87944ccae639027da172e120ea83ea8b4d06411a..39c00105f8d675e5cf5ce664b2d7416654c40cfb 100644
(file)
--- a/
lightning/src/ln/msgs.rs
+++ b/
lightning/src/ln/msgs.rs
@@
-394,12
+394,10
@@
pub enum NetAddress {
port: u16,
},
/// An old-style Tor onion address/port on which the peer is listening.
port: u16,
},
/// An old-style Tor onion address/port on which the peer is listening.
- OnionV2 {
- /// The bytes (usually encoded in base32 with ".onion" appended)
- addr: [u8; 10],
- /// The port on which the node is listening
- port: u16,
- },
+ ///
+ /// This field is deprecated and the Tor network generally no longer supports V2 Onion
+ /// addresses. Thus, the details are not parsed here.
+ OnionV2([u8; 12]),
/// A new-style Tor onion address/port on which the peer is listening.
/// To create the human-readable "hostname", concatenate ed25519_pubkey, checksum, and version,
/// wrap as base32 and append ".onion".
/// A new-style Tor onion address/port on which the peer is listening.
/// To create the human-readable "hostname", concatenate ed25519_pubkey, checksum, and version,
/// wrap as base32 and append ".onion".
@@
-421,7
+419,7
@@
impl NetAddress {
match self {
&NetAddress::IPv4 {..} => { 1 },
&NetAddress::IPv6 {..} => { 2 },
match self {
&NetAddress::IPv4 {..} => { 1 },
&NetAddress::IPv6 {..} => { 2 },
- &NetAddress::OnionV2
{..}
=> { 3 },
+ &NetAddress::OnionV2
(_)
=> { 3 },
&NetAddress::OnionV3 {..} => { 4 },
}
}
&NetAddress::OnionV3 {..} => { 4 },
}
}
@@
-431,7
+429,7
@@
impl NetAddress {
match self {
&NetAddress::IPv4 { .. } => { 6 },
&NetAddress::IPv6 { .. } => { 18 },
match self {
&NetAddress::IPv4 { .. } => { 6 },
&NetAddress::IPv6 { .. } => { 18 },
- &NetAddress::OnionV2
{ .. }
=> { 12 },
+ &NetAddress::OnionV2
(_)
=> { 12 },
&NetAddress::OnionV3 { .. } => { 37 },
}
}
&NetAddress::OnionV3 { .. } => { 37 },
}
}
@@
-453,10
+451,9
@@
impl Writeable for NetAddress {
addr.write(writer)?;
port.write(writer)?;
},
addr.write(writer)?;
port.write(writer)?;
},
- &NetAddress::OnionV2
{ ref addr, ref port }
=> {
+ &NetAddress::OnionV2
(bytes)
=> {
3u8.write(writer)?;
3u8.write(writer)?;
- addr.write(writer)?;
- port.write(writer)?;
+ bytes.write(writer)?;
},
&NetAddress::OnionV3 { ref ed25519_pubkey, ref checksum, ref version, ref port } => {
4u8.write(writer)?;
},
&NetAddress::OnionV3 { ref ed25519_pubkey, ref checksum, ref version, ref port } => {
4u8.write(writer)?;
@@
-486,12
+483,7
@@
impl Readable for Result<NetAddress, u8> {
port: Readable::read(reader)?,
}))
},
port: Readable::read(reader)?,
}))
},
- 3 => {
- Ok(Ok(NetAddress::OnionV2 {
- addr: Readable::read(reader)?,
- port: Readable::read(reader)?,
- }))
- },
+ 3 => Ok(Ok(NetAddress::OnionV2(Readable::read(reader)?))),
4 => {
Ok(Ok(NetAddress::OnionV3 {
ed25519_pubkey: Readable::read(reader)?,
4 => {
Ok(Ok(NetAddress::OnionV3 {
ed25519_pubkey: Readable::read(reader)?,
@@
-715,6
+707,10
@@
pub enum ErrorAction {
/// The peer did something harmless that we weren't able to meaningfully process.
/// If the error is logged, log it at the given level.
IgnoreAndLog(logger::Level),
/// The peer did something harmless that we weren't able to meaningfully process.
/// If the error is logged, log it at the given level.
IgnoreAndLog(logger::Level),
+ /// The peer provided us with a gossip message which we'd already seen. In most cases this
+ /// should be ignored, but it may result in the message being forwarded if it is a duplicate of
+ /// our own channel announcements.
+ IgnoreDuplicateGossip,
/// The peer did something incorrect. Tell them.
SendErrorMessage {
/// The message to send.
/// The peer did something incorrect. Tell them.
SendErrorMessage {
/// The message to send.
@@
-1922,10
+1918,9
@@
mod tests {
});
}
if onionv2 {
});
}
if onionv2 {
- addresses.push(msgs::NetAddress::OnionV2 {
- addr: [255, 254, 253, 252, 251, 250, 249, 248, 247, 246],
- port: 9735
- });
+ addresses.push(msgs::NetAddress::OnionV2(
+ [255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 38, 7]
+ ));
}
if onionv3 {
addresses.push(msgs::NetAddress::OnionV3 {
}
if onionv3 {
addresses.push(msgs::NetAddress::OnionV3 {