Implemented getblockfileinfo
RPC command to obtain block files related data.
The new RPC could be useful for:
-
Make manual pruning process more transparent: Currently, users blindly provide a height to
pruneblockchain
and only realizes up to which block the node was pruned from the RPC command result. This new introduced command lets the user know where to set thepruneblockchain
height by knowing the highest and lowest block heights stored on each file. So users will actually be able to remove specific block ranges (with some exceptions, as blocks can be stored out of order in different block files.. but that is a different topic). -
Make tests more robust and readable by removing magic numbers like the ones presented in
rpc_getblockfrompeer.py
(which are actually off by a good degree and not really document anywhere, see comment). -
And also for testing AssumeUTXO. Which, per mzumzande comment: it usage could result in block files with a very mixed-up block order. So having a way to analyse this better seems like it could be helpful. Also see a live scenario in theStack comment.