forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge bitcoin#21595: cli: create -addrinfo
06c4320 cli: use C++17 std::array class template argument deduction (CTAD) (Jon Atack) edf3167 addrinfo: raise helpfully on server error or incompatible server version (Jon Atack) bb85cbc doc: add cli -addrinfo release note (Jon Atack) 5056a37 cli: add -addrinfo command (Jon Atack) db4d2c2 cli: create AddrinfoRequestHandler class (Jon Atack) Pull request description: While looking at issue bitcoin#21351, it turned out that the problem was a lack of tor v3 addresses known to the node. It became clear (e.g. bitcoin#21351 (comment)) that a CLI command returning the number of addresses the node knows per network (with a tor v2 / v3 breakdown) would be very helpful. This patch adds that. `-addrinfo` is useful to see if your node knows enough addresses in a network to use options like `-onlynet=<network>`, or to upgrade to the upcoming tor release that no longer supports tor v2, for which you'll need to be sure your node knows enough tor v3 peers. ``` $ bitcoin-cli --help | grep -A1 addrinfo -addrinfo Get the number of addresses known to the node, per network and total. $ bitcoin-cli -addrinfo { "addresses_known": { "ipv4": 14406, "ipv6": 2511, "torv2": 5563, "torv3": 2842, "i2p": 8, "total": 25330 } } $ bitcoin-cli -addrinfo 1 error: -addrinfo takes no arguments ``` This can be manually tested, for example, with commands like this: ``` $ bitcoin-cli getnodeaddresses 0 | jq '.[] | (select(.address | contains(".onion")) | select(.address | length <= 22)) | .address' | wc -l 5563 $ bitcoin-cli getnodeaddresses 0 | jq '.[] | (select(.address | contains(".onion")) | select(.address | length > 22)) | .address' | wc -l 2842 $ bitcoin-cli getnodeaddresses 0 | jq '.[] | .address' | wc -l 25330 ``` ACKs for top commit: laanwj: Tested ACK 06c4320 Tree-SHA512: b668b47718a4ce052aff218789f3da629bca730592c18fcce9a51034d95a0a65f8e6da33dd47443cdd8f60c056c02696db175b0fe09a688e4385a76c1d8b7aeb
- Loading branch information
1 parent
d85f406
commit 1b464dd
Showing
2 changed files
with
76 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Tools and Utilities | ||
------------------- | ||
|
||
- A new CLI `-addrinfo` command returns the number of addresses known to the | ||
node per network type (including Tor v2 versus v3) and total. This can be | ||
useful to see if the node knows enough addresses in a network to use options | ||
like `-onlynet=<network>` or to upgrade to current and future Tor releases | ||
that support Tor v3 addresses only. (#5983) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters