Skip to content

Commit 0de84b7

Browse files
committed
Merge bitcoin/bitcoin#22544: cli -addrinfo: drop torv2; torv3 becomes onion per GetNetworkName()
49d503a doc: update -addrinfo in release-notes.md and tor.md (Jon Atack) 75ea9ec cli -addrinfo: drop torv2, torv3 becomes onion per GetNetworkName() (Jon Atack) Pull request description: #22050 removed torv2 support from 22.0. For 23.0 and subsequent releases, we can probably remove torv2 from -addrinfo. before ``` "addresses_known": { "ipv4": 58305, "ipv6": 5138, "torv2": 0, "torv3": 5441, "i2p": 14, "total": 68898 } ``` after ``` "addresses_known": { "ipv4": 58305, "ipv6": 5138, "onion": 5441, "i2p": 14, "total": 68898 } ``` Per the naming of `netbase.{h, cpp}::GetNetworkName()`, torv3 becomes onion, which is what is printed in the output of getpeerinfo, getnetworkinfo and getnodeaddresses. ACKs for top commit: practicalswift: cr ACK 49d503a Zero-1729: tACK 49d503a 🧉 klementtan: Code review and tested ACK 49d503a Tree-SHA512: bca52520d8b12c26f1c329d661b9e22c567954ed2af7d2a16d7669eae1a221eada20944f8b2f4e78e31a7190d5f3d3fbfd37509e5edf2d9a3747a0a8f4e375bb
2 parents cdf12c7 + 49d503a commit 0de84b7

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

doc/release-notes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ Tools and Utilities
9191

9292
- Update `-getinfo` to return data in a user-friendly format that also reduces vertical space. (#21832)
9393

94+
- CLI `-addrinfo` now returns a single field for the number of `onion` addresses
95+
known to the node instead of separate `torv2` and `torv3` fields, as support
96+
for Tor V2 addresses was removed from Bitcoin Core in 22.0. (#22544)
97+
9498
Wallet
9599
------
96100

doc/tor.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ There are several ways to see your local onion address in Bitcoin Core:
2323
You may set the `-debug=tor` config logging option to have additional
2424
information in the debug log about your Tor configuration.
2525

26-
CLI `-addrinfo` returns the number of addresses known to your node per network
27-
type, including Tor v2 and v3. This is useful to see how many onion addresses
28-
are known to your node for `-onlynet=onion` and how many Tor v3 addresses it
29-
knows when upgrading to Bitcoin Core v22.0 and up that supports Tor v3 only.
26+
CLI `-addrinfo` returns the number of addresses known to your node per
27+
network. This can be useful to see how many onion peers your node knows,
28+
e.g. for `-onlynet=onion`.
3029

3130
## 1. Run Bitcoin Core behind a Tor proxy
3231

src/bitcoin-cli.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ class BaseRequestHandler
242242
class AddrinfoRequestHandler : public BaseRequestHandler
243243
{
244244
private:
245-
static constexpr std::array m_networks{"ipv4", "ipv6", "torv2", "torv3", "i2p"};
245+
static constexpr std::array m_networks{"ipv4", "ipv6", "onion", "i2p"};
246246
int8_t NetworkStringToId(const std::string& str) const
247247
{
248248
for (size_t i = 0; i < m_networks.size(); ++i) {
@@ -268,13 +268,10 @@ class AddrinfoRequestHandler : public BaseRequestHandler
268268
if (!nodes.empty() && nodes.at(0)["network"].isNull()) {
269269
throw std::runtime_error("-addrinfo requires bitcoind server to be running v22.0 and up");
270270
}
271-
// Count the number of peers we know by network, including torv2 versus torv3.
271+
// Count the number of peers known to our node, by network.
272272
std::array<uint64_t, m_networks.size()> counts{{}};
273273
for (const UniValue& node : nodes) {
274274
std::string network_name{node["network"].get_str()};
275-
if (network_name == "onion") {
276-
network_name = node["address"].get_str().size() > 22 ? "torv3" : "torv2";
277-
}
278275
const int8_t network_id{NetworkStringToId(network_name)};
279276
if (network_id == UNKNOWN_NETWORK) continue;
280277
++counts.at(network_id);

0 commit comments

Comments
 (0)