confirm: IBD stamp plans from wire without TxApply - #262
Merged
Conversation
added 4 commits
August 25, 2026 19:17
IBD stamp cloned every script_sig/witness into TxApply, then discarded packed ins. archive_plan_batch_from_wire walks Block + txids, stamps SpendEdges and CreatePin, and leaves packed ins empty. from_store still drains TxApply for query tests. One finish_archive_plan stamps both.
wire_lookup_phase and one-shot load put header rows, filter by header_fk, and call archive_plan_batch_from_wire. Packed ins start empty so the post-plan clear is gone. CreatePin outs still match wire script_pubkey. Standalone prepare_block_for_archive is unchanged.
Empty edges with planned fks used to walk packed ins (often empty after wire plan) and silently skip spends. Pin now Corrupt. Tests that still build packed ins fill edges from those records.
unwrap_or(0) kept the wrong planned span when per_header_ranges first fk was absent. That is an invariant miss, not a default start index. Closes algo-review Q-M1.
rearden-grok
Bot
force-pushed
the
confirm/wire-plan-batch
branch
from
August 26, 2026 02:17
8f90828 to
a394f0a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IBD stamp no longer clones every
script_sig/ witness intoTxApplyjust to throw packed ins away after plan.archive_plan_batch_from_wirewalksBlock+ structure txids, stamps SpendEdges and CreatePin, leaves packed ins empty.from_storestill drains TxApply for query tests. Sharedfinish_archive_plan.wire_lookup_phase/ one-shot load filter by header_fk and call the wire planner.prepare_block_for_archivestays for standalone archive / resume.plan=Somerequires SpendEdges (no packed-ins fallback that silently skipped spends).retain_headers_needing_bodymissingfirstfk isCorrupt(algo-review Q-M1).Write still encodes Class A ins from
Arc<Block>+ SpendEdges. CreatePin outs stay stamp-time for in-flight.Independent of
query/recent-creates-cow.Test plan
cargo test -p rbitcoin-query --lib archive::cargo test -p rbitcoin-consensus --lib write_idempotentcargo test -p rbitcoin-consensus --lib bq_resolvecargo test -p rbitcoin-consensus --lib stamp_uses_caller_pres