Page MenuHomePhabricator

[backport#14802] rpc: faster getblockstats using BlockUndo data
ClosedPublic

Authored by majcosta on May 31 2020, 04:45.

Details

Summary

Using undo data for a block (rev?????.dat) we can retrieve value information about prevouts and calculate the final transaction fee (rate). This approach is about 80x faster, drops the requirement for -txindex, and works for all non-pruned blocks.

https://github.com/bitcoin/bitcoin/pull/14802/commits/d20d7567528e216badb8475df298bb3cec008985


Depends on D6304

Backport of Core PR14802

Test Plan
ninja
./test/functional/test_runner.py rpc_getblockstats --gen-test-data
ninja check-all

run bitcoin-cli getblockstats non-pruned-block-height on a node without -txindex now works

Diff Detail

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

Event Timeline

majcosta created this revision.May 31 2020, 04:45
Herald added a reviewer: Restricted Project. · View Herald TranscriptMay 31 2020, 04:45
majcosta requested review of this revision.May 31 2020, 04:45
majcosta edited the summary of this revision. (Show Details)May 31 2020, 04:47
majcosta edited the test plan for this revision. (Show Details)
deadalnix requested changes to this revision.May 31 2020, 21:59
deadalnix added a subscriber: deadalnix.

What the deal with test/functional/data/rpc_getblockstats.json ?

This revision now requires changes to proceed.May 31 2020, 21:59
majcosta updated this revision to Diff 20754.Jun 1 2020, 14:46
majcosta edited the summary of this revision. (Show Details)

that was an oversight on my part, I did not see that core generated new test data.

majcosta edited the test plan for this revision. (Show Details)Jun 1 2020, 14:48
majcosta edited the test plan for this revision. (Show Details)
deadalnix accepted this revision.Jun 1 2020, 22:00
This revision is now accepted and ready to land.Jun 1 2020, 22:00