Description
Blockchain network re-organizations can invalidate previously indexed events, resulting in the backend displaying phantom fractional shares.
Architecture & Context
The indexing engine must maintain a rolling window of "unfinalized" blocks. If a ledger sequence diverges from the expected hash, the backend must systematically rollback database mutations up to the common ancestor and replay the correct events.
Technical Requirements
- Track
ledger_hash and previous_ledger_hash in the database.
- Implement a rollback function that deletes events linked to orphaned ledgers.
- Automatically trigger the re-sync pipeline upon detecting a hash mismatch.
Acceptance Criteria
Description
Blockchain network re-organizations can invalidate previously indexed events, resulting in the backend displaying phantom fractional shares.
Architecture & Context
The indexing engine must maintain a rolling window of "unfinalized" blocks. If a ledger sequence diverges from the expected hash, the backend must systematically rollback database mutations up to the common ancestor and replay the correct events.
Technical Requirements
ledger_hashandprevious_ledger_hashin the database.Acceptance Criteria
503 Service Unavailableduring rollback.