Skip to content

query: --prune-inwit watermark, NETWORK_LIMITED, Core -8 - #654

Open
rearden-grok[bot] wants to merge 12 commits into
masterfrom
store/inwit-prune
Open

rearden-grok[bot] wants to merge 12 commits into
masterfrom
store/inwit-prune

Conversation

@rearden-grok

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

Copy link
Copy Markdown
Contributor

Summary

Plan 09 (docs/personal-node-plans/09-inwit-prune.md). Own store stack on master (unstacked from the net overlay PRs). #659 (store/txfixed) sits on this branch.

  • Query holds a persisted {store}/inwit.prune sidecar (4-byte LE). File presence is prune mode; u32::MAX means nothing dropped yet. Confirm past 288 heights writes tip-288.
  • Reconstruct, disconnect, and wire loads return StoreError::Pruned below the watermark instead of Corrupt.
  • --prune-inwit advertises NETWORK_LIMITED|WITNESS|P2P_V2 (not NETWORK). getdata maps pruned blocks to notfound. RPC uses Core -8; Electrum transaction.get returns "pruned"; Esplora omits reconstructed vin for pruned txs (vin: []).
  • Recent witness is RAM-first (288 heights) with --prune-inwit-ram-threshold-bytes (default 256 MiB) and spill under store/inwit.window/. Historical per-tx inwit.loc is not stub-rewritten. Enabling prune on an existing archive seeds the window; a pruned datadir without --prune-inwit is a hard startup error.
  • NixOS pruneInwit. No SCHEMA_VERSION bump (sidecar + spill files).

Closes #589

Test plan

  • cargo test -p rbitcoin-query reconstruct_pruned_returns_pruned_not_corrupt
  • cargo test -p rbitcoin-query reorg_through_pruneheight_refuses
  • cargo test -p rbitcoin-query prune_watermark_survives_reopen
  • cargo test -p rbitcoin-query prune_
  • cargo test -p rbitcoin-node prune_inwit_is_kebab
  • cargo test -p rbitcoin-rpc getblock_pruned_minus8
  • cargo test -p rbitcoin-net local_service_flags_pruned_are_limited_not_network
  • cargo test -p rbitcoin-esplora pruned_tx_json
  • cargo clippy --workspace --all-targets -- -D warnings
  • nix build .#checks.x86_64-linux.nixos-module-eval --no-link
  • required CI

Do not merge unless asked.

Comment thread crates/rbitcoin-query/src/lib.rs Fixed
Comment thread crates/rbitcoin-query/src/lib.rs Dismissed
@rearden-grok
rearden-grok Bot force-pushed the store/inwit-prune branch 2 times, most recently from badd49c to 0cbf383 Compare September 20, 2026 22:31
@rearden-grok
rearden-grok Bot changed the base branch from net/cjdns to master September 20, 2026 22:31
rearden-grok Bot and others added 12 commits September 20, 2026 23:10
Wire reconstruct must not look like Corrupt when inwit was dropped on
purpose. Query holds a stub pruneheight; rolling segments come next.

Co-authored-by: Cursor <cursoragent@cursor.com>
A reorg through pruned inwit cannot rebuild vin from spent alone. Fail
closed with StoreError::Pruned and leave the tip in place.

Co-authored-by: Cursor <cursoragent@cursor.com>
`--prune-inwit` must survive reopen. File presence is prune mode;
u32::MAX means nothing dropped yet. Confirm past 288 heights writes
tip-288 so the last BIP159 window stays reconstructable.

Co-authored-by: Cursor <cursoragent@cursor.com>
A pruned node is not NETWORK. VERSION, addrv2, and getaddr use the hub
flag; getdata maps StoreError::Pruned to notfound instead of disconnect.

Co-authored-by: Cursor <cursoragent@cursor.com>
getblock/getrawtransaction/getblockstats use the same -8 message Core
prints for pruned data. Electrum transaction.get returns \"pruned\";
Esplora answers 404.

Co-authored-by: Cursor <cursoragent@cursor.com>
Kebab CLI / snake conf / NixOS camelCase. Startup sets Query prune
mode and PeerHub so IBD from genesis advertises NETWORK_LIMITED before
the first 288-height watermark.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Prune mode no longer rewrites historical inwit.loc; recent witness lives in a 288-height RAM window with a byte threshold and store/inwit.window spill, and startup refuses a pruned datadir without --prune-inwit.

Co-authored-by: Cursor <cursoragent@cursor.com>
confirm_blocks_run_with_create_pins scored CRAP 31.1 after the RAM-window hook; move that post-tip work to a named helper so coverage-crap stays under 30.

Co-authored-by: Cursor <cursoragent@cursor.com>
Load by matching a dirent whose parsed height is the window slot, not
by joining the path. Intermediate path-join and dirent-only steps are
the same end state.

Co-authored-by: Cursor <cursoragent@cursor.com>
open_inwit hit clippy cognitive_complexity 27/25 after prune-inwit branches; loc open and count-skew repair are named seams, not a silent allow.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant