Blockchain reorganization

From Mini-blockchain Project
Jump to: navigation, search

Blockchain reorganization occurs whenever some type of fork occurs and some of the nodes are eventually forced to migrate over to the correct chain. This can happen simply because multiple blocks get solved at the same time, or because of a hardfork, or because of some type of attack or bug. To swap over to the correct chain the node will need to use the inversion database to unwind the account tree back to the origin point of the fork and then fast forward using transactions from the correct chain.

If the origin point of the fork is older than the cycle time, there's obviously a very long fork happening, and something is clearly very wrong with the network. It could even be a secret chain attack in progress. So in that situation all nodes except new nodes will just stick with the chain they already have unless specifically pointed to another chain. New nodes will essentially pick a random chain but the client will display a warning about the fork so the user knows what's happening.