aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-05-24 22:42:39 +0200
committerJon Atack <jon@atack.com>2021-05-28 01:46:29 +0200
commit7d1769bc450a98c093a066d6daed84337040dbfb (patch)
treededc1da1ae4ddcbd080091aebd95abb1a2771c58 /src
parenteba9a94b9f56be2fda623e77f19b960425ea1eb5 (diff)
p2p: remove torv2 from SetNetFromBIP155Network()
Diffstat (limited to 'src')
-rw-r--r--src/netaddress.cpp8
-rw-r--r--src/test/net_tests.cpp16
2 files changed, 2 insertions, 22 deletions
diff --git a/src/netaddress.cpp b/src/netaddress.cpp
index b6f0463a1d..4b4094fc25 100644
--- a/src/netaddress.cpp
+++ b/src/netaddress.cpp
@@ -72,14 +72,6 @@ bool CNetAddr::SetNetFromBIP155Network(uint8_t possible_bip155_net, size_t addre
throw std::ios_base::failure(
strprintf("BIP155 IPv6 address with length %u (should be %u)", address_size,
ADDR_IPV6_SIZE));
- case BIP155Network::TORV2:
- if (address_size == ADDR_TORV2_SIZE) {
- m_net = NET_ONION;
- return true;
- }
- throw std::ios_base::failure(
- strprintf("BIP155 TORv2 address with length %u (should be %u)", address_size,
- ADDR_TORV2_SIZE));
case BIP155Network::TORV3:
if (address_size == ADDR_TORV3_SIZE) {
m_net = NET_ONION;
diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp
index 1f5c29c657..46f88c1282 100644
--- a/src/test/net_tests.cpp
+++ b/src/test/net_tests.cpp
@@ -606,26 +606,14 @@ BOOST_AUTO_TEST_CASE(cnetaddr_unserialize_v2)
BOOST_CHECK(!addr.IsValid());
BOOST_REQUIRE(s.empty());
- // Valid TORv2.
+ // TORv2, no longer supported.
s << MakeSpan(ParseHex("03" // network type (TORv2)
"0a" // address length
"f1f2f3f4f5f6f7f8f9fa")); // address
s >> addr;
- BOOST_CHECK(addr.IsValid());
- BOOST_CHECK(addr.IsTor());
- BOOST_CHECK(!addr.IsAddrV1Compatible());
- BOOST_CHECK_EQUAL(addr.ToString(), "6hzph5hv6337r6p2.onion");
+ BOOST_CHECK(!addr.IsValid());
BOOST_REQUIRE(s.empty());
- // Invalid TORv2, with bogus length.
- s << MakeSpan(ParseHex("03" // network type (TORv2)
- "07" // address length
- "00")); // address
- BOOST_CHECK_EXCEPTION(s >> addr, std::ios_base::failure,
- HasReason("BIP155 TORv2 address with length 7 (should be 10)"));
- BOOST_REQUIRE(!s.empty()); // The stream is not consumed on invalid input.
- s.clear();
-
// Valid TORv3.
s << MakeSpan(ParseHex("04" // network type (TORv3)
"20" // address length