0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-04 10:07:27 -05:00
bitcoin-bitcoin-core/src/rpc
Andrew Chow ff564c75e7
Merge bitcoin/bitcoin#27511: rpc: Add test-only RPC getaddrmaninfo for new/tried table address count
28bac81a34 test: add functional test for getaddrmaninfo (stratospher)
c8eb8dae51 rpc: Introduce getaddrmaninfo for count of addresses stored in new/tried table (stratospher)

Pull request description:

  implements https://github.com/bitcoin/bitcoin/issues/26907. split off from #26988 to keep RPC, CLI discussions separate.

  This PR introduces a new RPC `getaddrmaninfo`which returns the count of addresses in the new/tried table of a node's addrman broken down by network type. This would be useful for users who want to see the distribution of addresses from different networks across new/tried table in the addrman.

  ```jsx
  $ getaddrmaninfo

  Result:
  {                   (json object) json object with network type as keys
    "network" : {     (json object) 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
      "total" : n     (numeric) total number of addresses in both new/tried tables from a network
    },
    ...
  }
  ```

  ### additional context from [original PR](https://github.com/bitcoin/bitcoin/pull/26988)

  1. network coverage tests were skipped because there’s a small chance that addresses from different networks could hash to the same bucket and cause count of different network addresses in the tests to fail. see https://github.com/bitcoin/bitcoin/pull/26988#discussion_r1137596851.
  2. #26988 uses this RPC in -addrinfo CLI. Slight preference for keeping the RPC hidden since this info will mostly be useful to only super users. see https://github.com/bitcoin/bitcoin/pull/26988#discussion_r1173964808.

ACKs for top commit:
  0xB10C:
    ACK 28bac81a34
  willcl-ark:
    reACK 28bac81a34
  achow101:
    ACK 28bac81a34
  brunoerg:
    reACK 28bac81a34
  theStack:
    Code-review ACK 28bac81a34

Tree-SHA512: 346390167e1ebed7ca5c79328ea452633736aff8b7feefea77460e04d4489059334ae78a3f757f32f5fb7827b309d7186bebab3c3760b3dfb016d564a647371a
2023-09-20 08:25:20 -04:00
..
blockchain.cpp assumeutxo cleanup: Move IsInitialBlockDownload & NotifyHeaderTip to ChainstateManager 2023-08-18 12:52:30 -04:00
blockchain.h refactor: Move fs.* to util/fs.* 2023-03-23 12:55:18 +01:00
client.cpp rpc: add test-only sendmsgtopeer rpc 2023-08-22 13:28:15 -04:00
client.h refactor: rpc: hide and rename ParseNonRFCJSONValue() 2023-03-23 18:18:46 +00:00
external_signer.cpp refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
fees.cpp rpc: Run type check against RPCArgs 2023-01-11 17:42:09 +01:00
mempool.cpp assumeutxo cleanup: Move IsInitialBlockDownload & NotifyHeaderTip to ChainstateManager 2023-08-18 12:52:30 -04:00
mempool.h rpc: Move mempool RPCs to new file 2022-03-11 17:46:58 +01:00
mining.cpp rpc: Add MaybeArg() and Arg() default helper 2023-08-24 10:44:45 +02:00
mining.h
net.cpp rpc: Introduce getaddrmaninfo for count of addresses stored in new/tried table 2023-09-19 16:02:55 +05:30
node.cpp Merge bitcoin/bitcoin#28186: kernel: Prune leveldb headers 2023-08-07 22:31:46 +02:00
output_script.cpp Add PubKeyDestination for P2PK scripts 2023-09-12 12:14:31 -04:00
protocol.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
rawtransaction.cpp Update help text for spend and rawtransaction rpcs 2023-08-22 22:29:08 -04:00
rawtransaction_util.cpp Fix clang-tidy performance-unnecessary-copy-initialization warnings 2023-05-09 18:48:52 +02:00
rawtransaction_util.h wallet: add outputs arguments to bumpfee and psbtbumpfee 2023-01-17 13:28:53 +02:00
register.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
request.cpp refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
request.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
server.cpp scripted-diff: Following the C++ Standard rules for identifiers with _. 2023-06-20 10:23:08 +02:00
server.h RPC: Add add OBJ_NAMED_PARAMS type 2023-05-03 11:27:51 -05:00
server_util.cpp refactor: Split util::AnyPtr into its own file 2023-05-20 12:03:33 +02:00
server_util.h net: add Ensure{any}Banman 2023-02-09 17:14:01 -03:00
signmessage.cpp rpc: Move signmessage RPC util to new file 2022-04-28 11:19:29 +02:00
txoutproof.cpp refactor: Move functions to BlockManager methods 2023-05-10 19:06:53 +02:00
util.cpp Add PubKeyDestination for P2PK scripts 2023-09-12 12:14:31 -04:00
util.h rpc: Add MaybeArg() and Arg() default helper 2023-08-24 10:44:45 +02:00