Skip to content

Commit 75ea9ec

Browse files
committed
cli -addrinfo: drop torv2, torv3 becomes onion per GetNetworkName()
1 parent 2aa937e commit 75ea9ec

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/bitcoin-cli.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ class BaseRequestHandler
245245
class AddrinfoRequestHandler : public BaseRequestHandler
246246
{
247247
private:
248-
static constexpr std::array m_networks{"ipv4", "ipv6", "torv2", "torv3", "i2p"};
248+
static constexpr std::array m_networks{"ipv4", "ipv6", "onion", "i2p"};
249249
int8_t NetworkStringToId(const std::string& str) const
250250
{
251251
for (size_t i = 0; i < m_networks.size(); ++i) {
@@ -271,13 +271,10 @@ class AddrinfoRequestHandler : public BaseRequestHandler
271271
if (!nodes.empty() && nodes.at(0)["network"].isNull()) {
272272
throw std::runtime_error("-addrinfo requires bitcoind server to be running v22.0 and up");
273273
}
274-
// Count the number of peers we know by network, including torv2 versus torv3.
274+
// Count the number of peers known to our node, by network.
275275
std::array<uint64_t, m_networks.size()> counts{{}};
276276
for (const UniValue& node : nodes) {
277277
std::string network_name{node["network"].get_str()};
278-
if (network_name == "onion") {
279-
network_name = node["address"].get_str().size() > 22 ? "torv3" : "torv2";
280-
}
281278
const int8_t network_id{NetworkStringToId(network_name)};
282279
if (network_id == UNKNOWN_NETWORK) continue;
283280
++counts.at(network_id);

0 commit comments

Comments
 (0)