aboutsummaryrefslogtreecommitdiff
path: root/src/net/tor_address.cpp
diff options
context:
space:
mode:
authortobtoht <tob@featherwallet.org>2023-05-12 11:36:21 +0200
committertobtoht <tob@featherwallet.org>2023-05-12 17:09:54 +0200
commit6ff87ef89f4644e3eb45f34d2a1ad93f9ca7da0e (patch)
treed60fc001ec8b65dadb2edb97ea3826b00e051ac0 /src/net/tor_address.cpp
parentMerge pull request #8760 (diff)
downloadmonero-6ff87ef89f4644e3eb45f34d2a1ad93f9ca7da0e.tar.xz
net: tor_address: remove support for v2 onion addresses
Diffstat (limited to '')
-rw-r--r--src/net/tor_address.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/net/tor_address.cpp b/src/net/tor_address.cpp
index 53b73a839..ad8b399c8 100644
--- a/src/net/tor_address.cpp
+++ b/src/net/tor_address.cpp
@@ -48,7 +48,6 @@ namespace net
constexpr const char tld[] = u8".onion";
constexpr const char unknown_host[] = "<unknown tor host>";
- constexpr const unsigned v2_length = 16;
constexpr const unsigned v3_length = 56;
constexpr const char base32_alphabet[] =
@@ -62,7 +61,7 @@ namespace net
host.remove_suffix(sizeof(tld) - 1);
//! \TODO v3 has checksum, base32 decoding is required to verify it
- if (host.size() != v2_length && host.size() != v3_length)
+ if (host.size() != v3_length)
return {net::error::invalid_tor_address};
if (host.find_first_not_of(base32_alphabet) != boost::string_ref::npos)
return {net::error::invalid_tor_address};
@@ -118,7 +117,6 @@ namespace net
if (!port.empty() && !epee::string_tools::get_xtype_from_string(porti, std::string{port}))
return {net::error::invalid_port};
- static_assert(v2_length <= v3_length, "bad internal host size");
static_assert(v3_length + sizeof(tld) == sizeof(tor_address::host_), "bad internal host size");
return tor_address{host, porti};
}
@@ -180,7 +178,6 @@ namespace net
bool tor_address::is_same_host(const tor_address& rhs) const noexcept
{
- //! \TODO v2 and v3 should be comparable - requires base32
return std::strcmp(host_str(), rhs.host_str()) == 0;
}