(follow-up to #8780)
There have been some requests for a client-side getinfo
and this is my PoC of how to do it. The high-level idea is to have one command to gather and show various information and statistics about a bitcoind
in one go.
This could be used as an opportunity to make getinfo
better, it doesn’t have to have exactly the same fields as the original RPC, e.g. a chain
instead of testnet
flag would make sense (but it is currently the same, according to this table: #8455 (comment)).
If this is considered a good idea some of the logic could be moved up to rpcclient.cpp and used in the GUI console as well.
Implementation
This adds the infrastructure BaseRequestHandler
class that takes care of converting bitcoin-cli arguments into a JSON-RPC request object, and converting the reply into a JSON object that can be shown as result.
This is subsequently used to handle the -getinfo
option, which sends a JSON-RPC batch request to the RPC server with ["getnetworkinfo", "getblockchaininfo", "getwalletinfo"]
, and after reply combines the result into what looks like a getinfo
result.