I am working on a blockchain parser. I first parse the header index to know where the data is located in the .blk files. And then I parse the blk files in the right order. (I use the data from my full node)
However I noticed that I am including an extinct block (see Single tx included in two different blocks) while parsing (and blockchain.info seems to do the same).
How is that possible? How to get the actual block?
While parsing the index I check the condition
NStatus&(blockHaveData|blockHaveUndo) != 0 before including the block, is that enough?
A validated block has
NStatus = 0x9d whereas the extinct block has
NStatus = 0x8b.
There does not seem to be another valid version of the extinct block in my index (height 525890)
Edit: The error comes from my validation condition
NStatus&(blockHaveData|blockHaveUndo) != 0. As a temporary fix when a given height is referenced twice in the index I keep the on with the largest