In commit “rpc: Introduce getaddrmaninfo for count of addresses stored in new/tried table” (332cf61a5cdf838a20117280dc2d24659a4b4a5c)
It seems inaccurate to say “RPC is for testing only” when PR description says “This would be useful for users who want to see the distribution of addresses from different networks across new/tried table in the addrman” which makes it sound like this is useful for troubleshooting or monitoring.
If the RPC is not intended just to test the software, I think it would also be nice if documentation gave a little hint of what the new and tried are tables so the functionality is discoverable.
I asked ChatGPT to write a documentation for a getaddrmaninfo
method and it went a little overboard but maybe the new/tried descriptions are useful:
getaddrmaninfo
Method Documentation
Method Name: getaddrmaninfo
Description:
The getaddrmaninfo
method is a custom JSON-RPC method available in bitcoind, which provides high-level information about the Address Manager (addrman) module. The Address Manager is responsible for managing and organizing the addresses of network nodes in the Bitcoin peer-to-peer network.
Parameters:
None
Result:
-
new_addresses: An integer representing the current number of addresses stored in the “new” table of the Address Manager. These are addresses that have been recently discovered but have not yet been successfully connected to by the node.
-
tried_addresses: An integer representing the current number of addresses stored in the “tried” table of the Address Manager. These are addresses of known nodes that the node has successfully connected to in the past and are considered accessible peers.
Note:
The Address Manager plays a crucial role in maintaining a healthy and well-connected peer-to-peer network. The “new” table stores potential new peers that are periodically tested for connectivity to increase the node’s network reach. The “tried” table contains addresses of reliable and accessible peers with whom the node has established successful connections.
Usage:
The getaddrmaninfo
method allows users to monitor the state of the Address Manager. By calling this method, users can retrieve the current counts of addresses in the “new” and “tried” tables, providing valuable insights into the node’s ongoing efforts to discover new peers and maintain connections to known reliable nodes.
Example Output:
0{
1 "new_addresses": 256,
2 "tried_addresses": 1024
3}
In this example, the node currently has 256 addresses in the “new” table and 1024 addresses in the “tried” table. These counts reflect the node’s active efforts to discover new peers (new addresses) and the established connections with known reliable peers (tried addresses) in the Bitcoin network.