#36266 rpc: Let dumptxoutset fail early on stale targets and concurrent runs
| Reviewability | Reviews | Agreement | Size | ||||
|---|---|---|---|---|---|---|---|
| #36266 rpc: Let dumptxoutset fail early on stale targets and concurrent runs | Waiting on author | 0 | Mild | 24 + 33 tests | |||
|
|
|
|
| |||
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:
| Reviewer | Type | Harm, request, or question | Status | Must be | Author replied | Quote |
|---|---|---|---|---|---|---|
| cyb3ralbert (contributor) | objection, correctness | If the target block leaves the active chain between the ActiveChain().Contains check and pinning the tip, dumptxoutset can still reach a CHECK_NONFATAL failure | open | answered | no | 2026-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
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