Skip to content

Commit 7d1769b

Browse files
committed
p2p: remove torv2 from SetNetFromBIP155Network()
1 parent eba9a94 commit 7d1769b

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

src/netaddress.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,6 @@ bool CNetAddr::SetNetFromBIP155Network(uint8_t possible_bip155_net, size_t addre
7272
throw std::ios_base::failure(
7373
strprintf("BIP155 IPv6 address with length %u (should be %u)", address_size,
7474
ADDR_IPV6_SIZE));
75-
case BIP155Network::TORV2:
76-
if (address_size == ADDR_TORV2_SIZE) {
77-
m_net = NET_ONION;
78-
return true;
79-
}
80-
throw std::ios_base::failure(
81-
strprintf("BIP155 TORv2 address with length %u (should be %u)", address_size,
82-
ADDR_TORV2_SIZE));
8375
case BIP155Network::TORV3:
8476
if (address_size == ADDR_TORV3_SIZE) {
8577
m_net = NET_ONION;

src/test/net_tests.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -606,26 +606,14 @@ BOOST_AUTO_TEST_CASE(cnetaddr_unserialize_v2)
606606
BOOST_CHECK(!addr.IsValid());
607607
BOOST_REQUIRE(s.empty());
608608

609-
// Valid TORv2.
609+
// TORv2, no longer supported.
610610
s << MakeSpan(ParseHex("03" // network type (TORv2)
611611
"0a" // address length
612612
"f1f2f3f4f5f6f7f8f9fa")); // address
613613
s >> addr;
614-
BOOST_CHECK(addr.IsValid());
615-
BOOST_CHECK(addr.IsTor());
616-
BOOST_CHECK(!addr.IsAddrV1Compatible());
617-
BOOST_CHECK_EQUAL(addr.ToString(), "6hzph5hv6337r6p2.onion");
614+
BOOST_CHECK(!addr.IsValid());
618615
BOOST_REQUIRE(s.empty());
619616

620-
// Invalid TORv2, with bogus length.
621-
s << MakeSpan(ParseHex("03" // network type (TORv2)
622-
"07" // address length
623-
"00")); // address
624-
BOOST_CHECK_EXCEPTION(s >> addr, std::ios_base::failure,
625-
HasReason("BIP155 TORv2 address with length 7 (should be 10)"));
626-
BOOST_REQUIRE(!s.empty()); // The stream is not consumed on invalid input.
627-
s.clear();
628-
629617
// Valid TORv3.
630618
s << MakeSpan(ParseHex("04" // network type (TORv3)
631619
"20" // address length

0 commit comments

Comments
 (0)