Page MenuHomePhabricator

rpc: Handle `getinfo` locally in bitcoin-cli w/ `-getinfo`

Authored by nakihito on Apr 9 2019, 01:06.


Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
rABCde194bfc6080: rpc: Handle `getinfo` locally in bitcoin-cli w/ `-getinfo`

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

There have been some requests for a client-side getinfo and this
is my PoC of how to do it. 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.

Extra-Author: Andrew Chow <>

Add test for bitcoin-cli -getinfo

Extra-Author: Andrew Chow <>

Backport of PR10871

Completes T586

Test Plan

make check
bitcoin-cli -getinfo

Diff Detail

rABC Bitcoin ABC
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

nakihito created this revision.Apr 9 2019, 01:06
Owners added a reviewer: Restricted Owners Package.Apr 9 2019, 01:06
Herald added a reviewer: Restricted Project. · View Herald TranscriptApr 9 2019, 01:06
deadalnix accepted this revision.Apr 9 2019, 14:54
deadalnix added inline comments.
235 ↗(On Diff #8003)

Fix comment layout

This revision is now accepted and ready to land.Apr 9 2019, 14:54
nakihito updated this revision to Diff 8014.Apr 9 2019, 18:01
nakihito marked an inline comment as done.

Fixed comment format.

This revision was automatically updated to reflect the committed changes.