mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-30 18:11:16 +02:00
p2p: remove torv2 from SetNetFromBIP155Network()
This commit is contained in:
@@ -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;
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user