chain reorganization – How do nodes deal with lengthy reorgs?


In a reorg the place a node receives blocks for an extended or equal-length chain than the chain they beforehand adopted as longest, what’s the course of for that node to deal with this example?

I can think about that within the scenario the brand new chain is clearly longer, the node must revert its UTXO set to the purpose at which the chains diverged, add again mempool transactions that have been used for the reason that chains diverged, after which re validate all blocks within the new chain. I may think about that some work that was already achieved in validating transactions may very well be reused, however not all of it.

How is the UTXO set reverted? Do nodes keep a historical past of UTXO set diffs?

Within the case the place the size of the chains are usually not considerably completely different, I can think about {that a} node may wish to keep each chains concurrently till it turns into clear one will likely be longer. Are nodes programmed to do that?

What’s the longest reorg a node can deal with with out revalidating all the chain from the genesis block?

These questions are primarily about how the software program is at present written, fairly than about theoretical methods nodes may deal with these instances.

Supply hyperlink

Leave a reply