Skip to content

Replace spacedb block indexes and snumeric index with SQLite#159

Merged
buffrr merged 2 commits intospacesprotocol:subspacesfrom
buffrr:indexes
Mar 24, 2026
Merged

Replace spacedb block indexes and snumeric index with SQLite#159
buffrr merged 2 commits intospacesprotocol:subspacesfrom
buffrr:indexes

Conversation

@buffrr
Copy link
Copy Markdown
Member

@buffrr buffrr commented Mar 24, 2026

This PR:

  • Adds --index_node_hashes flag to enable indexing hashes of internal nodes in spacedb for faster build_chain_proof. This is needed for certrelay since it builds proofs frequently. This flag is disabled by default.

  • Replaces the spaces block index (block_index.sdb) and nums block index (nums_block_index.sdb) with a single SQLite database (index.sqlite), since these indexes don't need merkle proofs.

  • Moves the snumeric→NumId mapping out of the production nums tree into SQLite, eliminating duplicate entries that inflate the tree

  • Snumeric index uses a composite integer primary key (block_height, tx_pos, vout) instead of a 32-byte hash .Sequential inserts, faster lookups, no hashing needed.

  • Inserts are staged in memory and batch-flushed at the existing 36-block commit interval

  • Reorgs handled via DELETE WHERE block_height > ? instead of spacedb snapshot rollback

@buffrr buffrr merged commit 31d16d1 into spacesprotocol:subspaces Mar 24, 2026
1 check passed
@buffrr buffrr deleted the indexes branch March 24, 2026 23:10
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