Where does core/virtualchain handle underlying chain forks?

@wanderingbort wrote on Slack:

Where does core/virtualchain handle underlying chain forks? If my bitcoin node follows a chain that ultimately gets orphaned and it gets indexed into my blockstack node, my consensus hashes will diverge and presumably allow me to detect that I’m in a bad state (if I trust the peers’ hashes) but I haven’t yet found how it cleans up the database etc? Is the expectation that divergence requires a re-indexing?

Yes that’s correct. Blockstack waits for 6 blocks to pass before it processes blocks and so chain reorganizations are rare. That said, when they happen, Core rolls back the operations of the orphaned chain and plays forward the operations of the new chain.

1 Like