I simply accomplished parsing the Testnet3 Bitcoin blockchain saved within the blk.dat information right into a database. Since I used to be utilizing multi-processing to parse a number of information on the identical time, I did not add the peak to the blockchain whereas parsing it. As an alternative, I did this after the entire blockchain was parsed.
All the things was going easily whereas including the peak to the blocks for probably the most half. Nonetheless, approaching the tip of the blockchain (the final 7%), my code began to crash as a result of it began to search out 2 totally different blocks that had the identical earlier block (mainly, a fork), and I had already constrained my database to keep away from having 2 blocks with the identical top. All these tiny forks I’ve been discovering are only one block lengthy, and it appears to be like just like the nearer I get to the tip, the commonest it’s to search out these tiny forks.
I’ve needed to look each block-ids up in a block explorer to search out out which one is the official block and which one is the fork (“faux” block). Considered one of them is all the time non-existent for which I do know it isn’t an ID misplacing. I’ve been manually deleting the hyperlink of the “faux” block so my code can maintain including the peak, however as I mentioned earlier than, it turns into increasingly widespread to search out these tiny forks the extra I method the tip of the blockchain.
I used to be simply questioning if that is regular, or if there’s something actually flawed with my blk.dat information.