DraftEngineering
Handling Blockchain Reorgs
A reorg is a delete plus a rebuild, keyed by block hash. This draft is the procedure the indexer already runs; the published note will include measured depths on Arc.
Context
Arc can reorganise its most recent blocks. Serving the head without a lag means serving data that may disappear.
Method
On every new block the indexer compares the parent hash with the stored hash at height − 1. A mismatch marks a reorg starting at the deepest divergent height.
Findings
Draft. Depths and frequencies will be published with Build Log #007.
Implications for the data model
All writes are keyed by (block_number, block_hash). Re-processing a block replaces its rows. The API lags the head by two blocks.