2

I have a full node with txindex enabled that I've been trying to use for an electrum server. However, whether I use ElectrumX or Electrs, I hit the same error on initial indexing of "Block not found on disk". With a bit of digging, I found out this error comes from the getblock rpc call, and the comment in the code for when this error is thrown is as follows:

Block not found on disk. This could be because we have the block header in our index but don't have the block (for example if a non-whitelisted node sends us an unrequested long chain of valid blocks, we add the headers to our index, but don't accept the block).

I'm not sure how I got to this state. This is a node I initially spun up several years ago and reindexed to use txindex earlier this year, I've never had any issues with it for other purposes or any data loss/corruption issues that I can recall. If anyone has a theory/explanation, I'd be interested to hear it.

My question is: Can I fix this error without starting over from scratch? I'd like to avoid even a reindex if possible, although I'm not even sure if that would fix it because as I understand it reindex uses the blocks on disk and apparently I'm missing a block on disk. Is there a way to get only the block or file(s) that I need? I have a friend with a full node who would let me copy files if needed.

I don't know exactly which block is missing yet, although I could probably figure that out with some more digging if it would be helpful.

1 Answer 1

2

Blocks are not stored in individual files, but flat bundles of a fixed size, so replacing one that is missing isn’t really possible. If a block can not be found on disk it has either keen deleted manually or by an errant process, or the disk is seriously corrupted. A re-index will fix this, but it’s an indicator of other possible issues related to hardware that this has happened.

3
  • 1
    Thank you very much. So I take it that even though reindex says Rebuild chain state and block index from the blk*.dat files on disk, it will fetch the missing block(s) from peers when it comes across it? Is -loadblock potentially of any use here if I can get a blk00??.dat file with the missing block? Oct 2, 2018 at 20:20
  • This is correct.
    – Claris
    Oct 3, 2018 at 1:13
  • 1
    Just to follow up on this, a reindex did work and took less time than I was expecting. Thank you! Nov 2, 2018 at 13:16

Your Answer

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

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