Skip to content

store: schema 22 restores spent.idx and packs spender vin - #484

Open
rearden-grok[bot] wants to merge 1 commit into
masterfrom
store/schema-22-spent-idx
Open

store: schema 22 restores spent.idx and packs spender vin#484
rearden-grok[bot] wants to merge 1 commit into
masterfrom
store/schema-22-spent-idx

Conversation

@rearden-grok

@rearden-grok rearden-grok Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Schema 22 restores spent.idx (u32 stride-8) so lookup can stamp spent (off,len) without reading txout.body. txout.body stays write-once; annotate RMW stays on spent.body (no RWF_DONTCACHE).
  • Spent slot is still 8 bytes: flags + u40 spend fk + u16 vin. Occupied 15–21 Class A with creates refuses (wipe datadir and redo IBD). Empty 15–21 rewrite meta to 22 and unlink leftover spent.off.
  • Esplora /outspend(s) emits vin from the slot (mempool overlay uses the hub tx input index). First-wave Outs guess is 4+(max_vout+1)×38.

Supersedes #477 (process-lifetime n_out[]); do not merge that PR.

Test plan

  • cargo test -p rbitcoin-store --lib filters: open_schema, spent_slot, spent_range, class_a_append_writes_spent, pipeline_outs_guess, spender, uring_rmw, put_spend
  • cargo test -p rbitcoin-esplora --lib outspend
  • cargo test -p rbitcoin-consensus --lib write/pin/structural filters
  • Required CI: fmt, deny, clippy, ast-grep, test, windows, macos, multinode, coverage

Made with Cursor

Occupied 21 Class A cannot decode the new 40/16 slot, so open refuses
and asks for a wipe + IBD. Lookup stamps spent ranges from idx only;
txout.body stays write-once. Esplora /outspend(s) reads vin from the
slot instead of inwit.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread crates/rbitcoin-esplora/src/handlers.rs Dismissed
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