Expose addrman size info via RPC #26907

issue amitiuttarwar openend this issue on January 17, 2023
  1. amitiuttarwar commented at 5:14 pm on January 17, 2023: contributor

    If #26847 gets merged, addrman will maintain counts of addresses stored on the new & tried tables, broken down by network. This is useful information for monitoring the state of our addrman when we run it with different network configs on mainnet.

    Currently when running a node, we can get a rough estimate into this information using the cli argument -addrinfo. However, this is just an estimate because it uses the RPC endpoint getnodeaddresses, which calls through to Addrman::GetAddr. Although this logic path skips the addr caching logic we apply for results propagated to the p2p network, it still applies some logic to filter results. For example it removes addresses that meet the IsTerrible attributes. It also doesn’t distinguish between the new and tried tables.

    So, I recommend we expose the raw counts to provide a better picture of addrman’s workings, especially since addrman & network integrations are particularly hard to test via our automated tooling. We can breakdown the counts by network & new vs tried.

    There are a few different options for how we can expose this information. I expect this feature to primarily be used by bitcoin core contributors or super-users that understand bitcoind’s inner workings. Thus, I suggest we expose it as a new, hidden RPC. That enables exposing the information to devs without having to guarantee a stable RPC interface over future versions. The name of the RPC can be something generic like addrmaninfo, to allow for future extensions for other debugging information.

    For more historic context around bitcoin cli’s -addrinfo and conversation about cli vs RPC, see #21595. If we do end up implementing a new RPC endpoint, we could consider reworking the cli to use these values directly rather than trying to compute them with partial information.

  2. amitiuttarwar added the label Feature on Jan 17, 2023
  3. stratospher commented at 9:25 pm on January 29, 2023: contributor

    This would be useful to have. I’ve tried this RPC endpoint in #26988 with the following structure.

    addrmaninfo ( "network" )
    
    Arguments:
    1. network    (string, optional) Network type (ipv4, ipv6, onion, i2p, cjdns)
    
    Result:
    [
      {
        "network" : "str",    (string) The network (ipv4, ipv6, onion, i2p, cjdns)
        "new" : n,            (numeric) number of addresses in new table
        "tried" : n           (numeric) number of addresses in tried table
      },
      ...
    ]
    
  4. achow101 referenced this in commit ff564c75e7 on Sep 20, 2023
  5. 0xB10C commented at 11:35 pm on September 22, 2023: contributor
    Can be closed now that #27511 is merged!
  6. MarcoFalke closed this on Sep 23, 2023


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-05 19:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me