Skip to content

store: schema 25 txstat.body 8 B/create ULEB - #659

Open
rearden-grok[bot] wants to merge 8 commits into
store/inwit-prunefrom
store/txfixed
Open

rearden-grok[bot] wants to merge 8 commits into
store/inwit-prunefrom
store/txfixed

Conversation

@rearden-grok

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

Copy link
Copy Markdown
Contributor

Summary

Schema 25 dense txstat.body (8 B/create canonical ULEB) stacked on #654 (store/inwit-prune). Occupied schema 24 zero-extends the file; txout.body is not rewritten. Unreleased leftover txfixed.body is unlinked.

Rebased onto the updated #654, which is on master (698177c8).

  • Confirm stamps n_in / fee_sat / base / wit_extra. Size and weight are derived (size = base + wit_extra, weight = 4×base + wit_extra). No sigops field. Overflow remaining-bytes live in per-header txstat.ovf + txstat.blk.
  • getblockstats reads stamped rows. Coinbase stays out of ins, fees, and the size totals, matching Core. utxo_increase is every output minus those inputs. utxo_increase_actual is the same after dropping outputs that do not enter the UTXO set (height 0, the two mainnet BIP30-repeat coinbases, unspendable scripts). Coins-DB utxo_size_inc / utxo_size_inc_actual are omitted.
  • Pruned Esplora /tx omits vin. Stamped txstat fills fee / size / weight when base or wit_extra is non-zero. A missing wire transaction leaves the txstat cell unstamped (all-zero), so getblockstats reconstructs from the wire body.

Test plan

  • cargo test -p rbitcoin-store --lib txstat
  • cargo test -p rbitcoin-rpc --lib getblockstats_
  • cargo test -p rbitcoin-esplora --lib pruned_tx_json
  • cargo test -p rbitcoin-query --lib stamp_txstat_from_block
  • required CI

Do not merge unless asked.

Comment thread crates/rbitcoin-esplora/src/tx_json.rs Fixed
Comment thread crates/rbitcoin-esplora/src/tx_json.rs Dismissed
Comment thread crates/rbitcoin-esplora/src/tx_json.rs Dismissed
Comment thread crates/rbitcoin-esplora/src/tx_json.rs Dismissed
Comment thread crates/rbitcoin-esplora/src/tx_json.rs Dismissed
Comment thread crates/rbitcoin-esplora/src/tx_json.rs Dismissed
Comment thread crates/rbitcoin-store/src/tx_table/tests.rs Dismissed
@rearden-grok rearden-grok Bot changed the title store: schema 25 txfixed.body 16 B/create store: schema 25 txstat.body 8 B/create ULEB Sep 20, 2026
Comment thread crates/rbitcoin-esplora/src/tx_json.rs Fixed
Comment thread crates/rbitcoin-esplora/src/tx_json.rs Dismissed
Comment thread crates/rbitcoin-esplora/src/tx_json.rs Fixed
@rearden-grok
rearden-grok Bot force-pushed the store/txfixed branch 2 times, most recently from c985c60 to 02ce85e Compare September 21, 2026 06:36
Comment thread crates/rbitcoin-esplora/src/tx_json.rs Dismissed
rearden-grok Bot and others added 6 commits September 22, 2026 09:05
Replace packing n_in into txout leftover with a dense 8 B/create
txstat cell (fee/size/weight/n_in/sigops). Class A append publishes
txstat.body with txid.body; leftover 24 B occupied rows still decode.
Confirm, reconstruct, getblockstats, and pruned esplora JSON read the
cells. Leftover txfixed.body is unlinked.

Co-authored-by: Cursor <cursoragent@cursor.com>
txstat truncate left repair_class_a_count_skew at CRAP 31.9. Target
count, stem ends, truncate, and align-check are separate fns.

Co-authored-by: Cursor <cursoragent@cursor.com>
An empty vin array is not the inputs we dropped and is easy to treat as
a coinbase. Pruned /tx keeps vout, status, and txstat fee/size/weight,
and leaves vin absent.
A placeholder with n_in set and size 0 is a stamped row. getblockstats
would report a real zero-size, zero-fee transaction instead of
reconstructing or refusing.
The file header and SCHEMA_VERSION constant already say 25. Two body
sentences still said 24, and the openable range stopped at 24.
utxo_size_inc, utxo_increase_actual, and utxo_size_inc_actual follow
Core v29: serialized output plus 41 bytes of coins-DB overhead. Height 0
and the two BIP30-repeat coinbases stay out of the actual counts. Coinbase
stays out of ins, fees, and the size totals, the same way Core's loop does.
The UTXO delta and non-coinbase total_out travel together so
stats_from_txstat stays at seven arguments.
utxo_increase_actual is spendable outputs minus non-coinbase inputs
(height 0, BIP30-repeat coinbases, and unspendable scripts stay out).
utxo_size_inc and utxo_size_inc_actual need coins-database overhead, so
they are not returned. Size totals still exclude the coinbase, matching
Core.
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