#36266 rpc: Let dumptxoutset fail early on stale targets and concurrent runs

ReviewabilityReviewsAgreementSize
#36266 fjahr rpc: Let dumptxoutset fail early on stale targets and concurrent runsWaiting on author0Mild24 + 33 tests
  • Stop dumptxoutset from doing heavy UTXO copies and block disconnects before failing on stale targets
  • Prevent file corruption and prune-lock collisions by restricting dumptxoutset to a single running instance
  • Ready to review
  • No review verdicts recorded
  • Unaddressed objection: a reorg before tip pinning still triggers a CHECK_NONFATAL failure (cyb3ralbert)
  • Waiting on author reply regarding revalidation against the pinned tip (cyb3ralbert)
  • 24 lines added or modified outside tests
  • 33 lines added or modified in tests
  • 12 lines removed in total
  • 2 files, 2 commits
RPC / REST / ZMQ#23 of 55
P3 · bug fix
  • P3 because it prevents file corruption and prune-lock collisions from concurrent dumptxoutset runs
  • It avoids expensive, wasteful UTXO set copies when rolling back to a stale block target
Reviewability: ReadyStalePaused
Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets
Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs.
Size: lines added or modified outside tests, then in tests; greener = smaller.

Goal

This pull request updates `dumptxoutset` to fail early on two edge cases. It verifies that a rollback target block index is actually on the active chain before copying UTXO data and disconnecting blocks, and it introduces a guard that restricts `dumptxoutset` to a single running instance to avoid file corruption and prune-lock collisions.

Problem: Currently, requesting a rollback to a stale block hash causes `dumptxoutset` to copy the full UTXO set and disconnect blocks down from the tip before ultimately failing. Additionally, initiating concurrent `dumptxoutset` calls results in both jobs writing to the same temporary `.incomplete` file and prematurely deleting or clobbering each other's prune locks.

Reviewability

Paused · Waiting on author

Open objection from cyb3ralbert with no author reply for 10 days; review would repeat what has been asked.

Waiting on (from the thread read):

  • author: response to cyb3ralbert's objection regarding the reorg race condition hitting CHECK_NONFATAL 2026-10-22
  • author: response to cyb3ralbert's concern regarding reorg race condition reaching CHECK_NONFATAL 2026-10-22

Agreement

Mild

objection that needs an answer has none yet (cyb3ralbert)

Thread notes: cyb3ralbert reported a race condition where a reorg between the initial active chain check and snapshot creation can still trigger a CHECK_NONFATAL assertion failure, suggesting revalidation against the pinned tip. / Initial record. cyb3ralbert reported a race condition where a reorg between the active chain check and pinning the tip allows dumptxoutset to reach CHECK_NONFATAL, proposing a revalidation check against the pinned tip.

Objections, suggestions, and questions:

ReviewerTypeHarm, request, or questionStatusMust beAuthor repliedQuote
cyb3ralbert (contributor)objection, correctnessIf the target block leaves the active chain between the ActiveChain().Contains check and pinning the tip, dumptxoutset can still reach a CHECK_NONFATAL failureopenansweredno2026-10-22: 'Is it intentional that if the target leaves the active chain between these two points, the operation can still reach CHECK_NONFATAL(rollback_cache.GetBestBlock() == target->GetBlockHash()) at :3365?'

Participants:

  • cyb3ralbert (contributor, objection, 1 statements 2026-10-22 to 2026-10-22): pointed out target block leaving active chain can still trigger CHECK_NONFATAL

Files

34 lines under test/bench/ci.

  • src/rpc/blockchain.cpp +24/-11
  • test/functional/rpc_dumptxoutset.py +33/-1

Card

The short text the ranking pass compares across PRs.

This PR updates the `dumptxoutset` RPC to exit early when passed a rollback target that is not on the active chain and to reject concurrent executions. Without this change, rollback to a stale block executes an expensive UTXO copy before failing, and simultaneous invocations write to the same temporary file and clobber prune locks. The change is small, includes functional test coverage, and has not yet received review.

Data

dossier JSON · extract JSON · model ledger, generated 2026-10-23T01:17, confidence high, input hash ecbb7239db71bd73
thread read through 2026-10-22 (1 statements), head 31000db0ea
labels: RPC/REST/ZMQ

Categories

RPC / REST / ZMQ

P3 · bug fix

It fixes file corruption and prune-lock collisions from concurrent `dumptxoutset` invocations and avoids heavy wasteful UTXO copies on stale rollback targets. While dumptxoutset is an administrative command and these are edge cases, addressing file corruption and unnecessary expensive operations provides clear value.

Membership: Matches RPC/REST/ZMQ label and modifies `dumptxoutset` handling in src/rpc/blockchain.cpp.

Factors: security/stability 1, bug 1, performance 1, user value 1, leverage 0