Conversation
Signed-off-by: sczembor <stanislaw.czembor@gmail.com>
Reviewer's GuideThis PR refactors the database schema by renaming two core tables and introducing explicit status columns for block and minting records; it updates all D1 queries and transaction workflows in the Indexer to reference the new tables and handle status transitions, adjusts the initial max-height lookup, and regenerates the Wrangler type definitions. Class diagram for Indexer storage and status handling changesclassDiagram
class Indexer {
+scanNewBlocks()
+processFinalizedTransactions()
+updateConfirmationsAndFinalize(latestHeight)
+findNbtcDeposits(tx)
+selectFinalizedNbtcTxs(pendingTxs, latestHeight)
+update block and minting statuses
}
class D1PreparedStatement
Indexer --> D1PreparedStatement : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Signed-off-by: sczembor <43810037+sczembor@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR implements a database schema refactor to support persistent status tracking for Bitcoin block processing and nBTC minting transactions. The changes rename existing tables for clarity and introduce status-based workflow management instead of deletion-based processing.
- Rename
processed_blockstobtc_blocksandnbtc_txstonbtc_mintingfor better semantic clarity - Add status columns to track processing states instead of deleting records
- Update all SQL queries and indexes to use the new table names and status-based filtering
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/btcindexer/src/index.ts | Update table name reference in latest block query |
| packages/btcindexer/src/btcindexer.ts | Comprehensive updates to use new table names, status-based filtering, and timestamp functions |
| packages/btcindexer/db/migrations/0001_initial_schema.sql | Database schema migration with table renames, status columns, and updated indexes |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: sczembor <43810037+sczembor@users.noreply.github.com>
Description
Closes: #52
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!to the type prefix if API or client breaking changeCHANGELOG.mdSummary by Sourcery
Introduce persistent status tracking by renaming the processed_blocks and nbtc_txs tables, adding a status column to both schemas, and updating SQL logic to filter and update records by status instead of deleting them. Regenerate worker types with updated configuration.
New Features:
Enhancements:
Build: