Page MenuHomePhabricator

RPC: Introduce getblockstats to plot things

Authored by Fabien on Mon, Jul 29, 10:32.


Group Reviewers
Restricted Project
rABCb0ec7a2db413: RPC: Introduce getblockstats to plot things
It returns per block statistics about several things. It should be easy
to add more if people think of other things to add or remove some if I
went too far (but once written, why not keep it? EDIT: answer: not to
test or maintain them).

The currently available options are:
(EDIT: see updated list in the rpc call documentation)

For the x axis, one can use height or block.nTime (I guess I could add
mediantime if there's interest [EDIT: nobody showed interest but I
implemented mediantime nonetheless, in fact there's no distinction
between x or y axis anymore, that's for the caller to judge]).

To calculate fees, -txindex is required.

Partial backport of core PR10757 (commits 35e77a0, 4cbfb6a and 41d0476)

Depends on D3755.

The behavior of the getblockstats RPC has been changed from the PR:

  • It does not include segwit related statistics
  • The amounts are expressed in BCH instead of Satoshis. This make it consistent with other RPCs.
Test Plan
make check
./src/bitcoin-cli help getblockstats
./test/functional/ rpc_getblockstats --gen-test-data
./test/functional/ rpc_getblockstats

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

Fabien created this revision.Mon, Jul 29, 10:32
Herald added a reviewer: Restricted Project. · View Herald TranscriptMon, Jul 29, 10:32
deadalnix accepted this revision.Thu, Aug 1, 06:12
This revision is now accepted and ready to land.Thu, Aug 1, 06:12
This revision was automatically updated to reflect the committed changes.