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

Event Timeline

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 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)
This revision is now accepted and ready to land.Jun 1 2020, 22:00