5

I am running a full node, bitcoin core 22. It is not in pruned mode. But when I try to run RPC getblockstats call I get this.

$ bitcoin-cli getblockstats 0                                                                   
error code: -1
error message:
Can't read undo data from disk

I don't have any error with block 1. And I tested it in two different nodes in two different machines, and I get the same error.

Why this happens?

2

1 Answer 1

6

This occurs because the genesis block is a special block. It is not written to disk like all other blocks are. It cannot be undone so there is no undo data for it. getblockstats uses the undo data (essentially a compact representation of the UTXOs spent by the transactions in a block) to calculate many of the block stats, but because the genesis block does not have undo data, you see this error.

The error could be improved, or a special case added for the genesis block. Regardless, this error is because of how the RPC is implemented, not with your nodes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.