[backport#14802] rpc: faster getblockstats using BlockUndo data
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
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Subscribers: deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D6305