Post
Topic
Board Bitcoin Technical Support
Re: How to resolve forks while reading .dat files?
by
ranochigo
on 06/07/2017, 11:02:41 UTC
You need to take into account future blocks to detect orphans.   The longer path is the main chain.

Yes, but it's a sort of a race condition between forks, at which point you measure which one is longer, after the second block arrives in one of the forks?
How long ( or by how many blocks longer) one fork needs to be to win?
At least one; if any of the chain has a higher weight (difficulty and length factored in), those that see that chain will accept it as valid. That is the behaviour of the reference client.

With that in mind, someone can create their own chain from block 1000 to 1005 and when the network has mined till 1004, that person releases all the blocks from 1000 to 1005 and the original 1000 to 1004 will be orphaned.