I am trying to gather some stats based on a recently mined block, that I need to update continuously.
One of the stat I am interested in is how many transaction are with round amount fees in the latest block.
To do this, I would need to getblock then for each transaction input, get the previous one via getrawtransaction. Now two problems with this:
- This require an enormous amount of requests.
- This need
txindex=1
Would it be realistic instead, to just fetch the spent output data directly from the Block Undo data that is still stored in the disk? This data is guaranteed to be always around as we need it to handle reorg. It also contains all the information I would need for the whole block in one continuous storage area. (instead of querying around via txindex).
Is there any other way I am missing?
If I were to make a PR to add this feature, I think the easiest way would be to just expose the block undo data directly with a RPC method.