Rework of -addrinfo
CLI is done using getaddrmaninfo
RPC proposed in #27511. This would be useful for users who want to know the total number of addresses the node knows about and can make connections to.
Currently, -addrinfo
returns total number of addresses the node knows about after filtering them for quality + recency using isTerrible
. However isTerrible
addresses don’t matter when selecting outbound peers to connect to. Total number of addresses the node knows about could be higher than what -addrinfo
currently displays. See #24370.
open questions:
- should we continue displaying filtered address stats?
currently the PR displays both total + filtered addresses stats. the total address stats is more relevant since that is what is used by node to find peers to connect to. the filtered addresses stats is kept as it is for not breaking backward compatibilty when a newer bitcoin-cli is used on an older bitcoind binary (v22 - v25). my personal preference is for displaying only the relevant total addresses stats - see this branch. but i’m fine with either approach based on what reviewers think.
0$ build/bin/bitcoin-cli -addrinfo
1{
2 "all addresses known (used for selecting peers)": {
3 "ipv4": 5927,
4 "ipv6": 958,
5 "onion": 382,
6 "i2p": 0,
7 "cjdns": 0,
8 "total": 7267
9 },
10 "addresses known after quality/recency filtering (for original -addrinfo compatibility)": {
11 "ipv4": 5888,
12 "ipv6": 928,
13 "onion": 382,
14 "i2p": 0,
15 "cjdns": 0,
16 "total": 7198
17 }
18}