aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-05-27 18:35:55 +0200
committerJon Atack <jon@atack.com>2021-06-03 13:36:48 +0200
commit5f9d3c09b4c9cd026cdc7c3a81f91632280917b7 (patch)
treefef73e091404e72862e921b2add77997b70466cd
parent3d390421440f1cae9a9f2b089561c183ecd1b073 (diff)
p2p: remove torv2 from CNetAddr::ToStringIP()
-rw-r--r--src/netaddress.cpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/netaddress.cpp b/src/netaddress.cpp
index 11ad214107..187507fe1f 100644
--- a/src/netaddress.cpp
+++ b/src/netaddress.cpp
@@ -603,24 +603,13 @@ std::string CNetAddr::ToStringIP() const
return IPv6ToString(m_addr, m_scope_id);
}
case NET_ONION:
- switch (m_addr.size()) {
- case ADDR_TORV2_SIZE:
- return EncodeBase32(m_addr) + ".onion";
- case ADDR_TORV3_SIZE: {
-
- uint8_t checksum[torv3::CHECKSUM_LEN];
- torv3::Checksum(m_addr, checksum);
-
- // TORv3 onion_address = base32(PUBKEY | CHECKSUM | VERSION) + ".onion"
- prevector<torv3::TOTAL_LEN, uint8_t> address{m_addr.begin(), m_addr.end()};
- address.insert(address.end(), checksum, checksum + torv3::CHECKSUM_LEN);
- address.insert(address.end(), torv3::VERSION, torv3::VERSION + sizeof(torv3::VERSION));
-
- return EncodeBase32(address) + ".onion";
- }
- default:
- assert(false);
- }
+ uint8_t checksum[torv3::CHECKSUM_LEN];
+ torv3::Checksum(m_addr, checksum);
+ // TORv3 onion_address = base32(PUBKEY | CHECKSUM | VERSION) + ".onion"
+ prevector<torv3::TOTAL_LEN, uint8_t> address{m_addr.begin(), m_addr.end()};
+ address.insert(address.end(), checksum, checksum + torv3::CHECKSUM_LEN);
+ address.insert(address.end(), torv3::VERSION, torv3::VERSION + sizeof(torv3::VERSION));
+ return EncodeBase32(address) + ".onion";
case NET_I2P:
return EncodeBase32(m_addr, false /* don't pad with = */) + ".b32.i2p";
case NET_CJDNS: