Skip to content

Detect protocol reparses with durable ledger checkpoints - #31

Merged
droplister merged 1 commit into
masterfrom
fix/protocol-ledger-checkpoints
Oct 4, 2026
Merged

droplister merged 1 commit into
masterfrom
fix/protocol-ledger-checkpoints

Conversation

@droplister

Copy link
Copy Markdown
Member

Counterparty can reparse protocol state while retaining the same Bitcoin block hash. The indexer previously treated that checkpoint as unchanged, including after an interrupted block, leaving orphaned application rows in place.

Retain ledger and message hashes in completed and pending checkpoints, verify fixed block and parent identities before writes, and use protocol-verified ancestors for exact rollback. Ordinary new descendants remain valid. Missing protocol evidence stops replay without erasing state. Migration 0054 adds nullable checkpoint columns; the first successful pass establishes a baseline and does not claim evidence for older NULL rows.

Validation: real SQLite replay regressions for completed and interrupted reparses, messages-only changes, new descendant arrival, missing hashes and missing historical evidence. Full API tests, Worker/D1 migration tests, generated types, promise lint and TypeScript checks pass. Migration must precede deployment; the existing deployment workflow enforces that order.

@droplister
droplister merged commit f2c43bb into master Oct 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant