5 suggestions
Optional improvements
[suggestion] · Pruning is enabled before pruned-block lookup handling lands
The series temporarily accepts -prune with -txindex while FindTx still reports pruned active-chain blocks as corruption; the head fixes this, but delaying enablement would make intermediate revisions coherent.
Location: src/init.cpp:1033 at 5d7f954442bd (parent of 9ab3eb2b6fca) (commit).
Details and suggested fix
9ab3eb2b6fca74415d24df4141a84e1320bb8055 enables pruning for a non-legacy txindex while FindTx still warns about corruption and throws for an active-chain candidate without block data. 591ff903b2302c75213c713f3be5aad5c339a0e7 adds the IsBlockPruned and TxMiss handling, and 281247bdb6b4a98f639258ea3cd01bce9f6e58d3 propagates the recovery hints through RPC and REST. Stopping at the enablement commit therefore exposes misleading lookup errors during review or bisect.
Move the enablement commit after those two lookup changes and before the end-to-end tests in ff0d8880cf2aa535fe264bf0ebe9bbcfc2949a89, keeping its AllowPrune, initialization checks and tests together. The lookup unit tests simulate pruning locally rather than enabling it through startup, so they can precede enablement. Leave the independent undo-data fix 68e154438a5e36b7da3beba517303b8bb7e21d59 and JSON-RPC prerequisite 5d7f954442bd411d1676e2d890a7c8efb3d5d723 first. Each intermediate revision would then either reject the combination or provide its recovery behavior, with the final tree unchanged.
[suggestion] · Recovery help omits getblockfrompeer's privacy tradeoff
The new recovery help recommends explicitly fetching candidate blocks with getblockfrompeer without explaining that the chosen peer learns those block hashes, although the txid itself is not sent.
Location: src/rpc/rawtransaction.cpp:263 (head).
Details and suggested fix
The existing FetchBlock path puts the requested block hash in GETDATA sent to peer_id. A caller recovering their own transactions through an untrusted peer can therefore disclose which historical blocks interest them. Neither the new getrawtransaction and gettxoutproof help nor getblockfrompeer's help explains that tradeoff. Add a sentence beside both recovery recommendations explaining the disclosure and recommending a trusted peer for privacy-sensitive lookups. Recovery remains an explicit, caller-controlled action.
[suggestion] · Re-fetched blocks have no 288-block retention guarantee
The PR description's 288-block retention promise is not provided by existing pruning: a batch of historical fetches can become prunable under automatic pruning pressure without the tip advancing.
Location: src/rpc/txoutproof.cpp:53 (head).
Details and suggested fix
MIN_BLOCKS_TO_KEEP protects heights relative to the active tip, not download age. FindNextBlockPos records each fetched block's original height and rolls to a new file when necessary. Once historical downloads fill a file containing only old blocks and spill into another file, the completed file loses the newest-file protection. Under automatic pruning pressure, the pruning-capable flush in AcceptBlock can remove it before the caller retries. Sharing a file with recent-height blocks can protect a fetched block, but does not establish a retention window. Remove the 288-block promise from the PR description and describe recovery as subject to re-pruning, matching the existing getblockfrompeer help.
[suggestion] · New tests miss FindTx's failed-open pruning recovery
The added tests do not deterministically exercise pruning between candidate collection and OpenBlockFile, so they cannot distinguish the new failed-open recovery from the previous exception.
Location: src/index/txindex.cpp:233 (head).
Details and suggested fix
FindTx copies candidate positions under cs_main, then opens their files without that lock. Pruning can clear availability and unlink a file in between. The unit-test PruneBlock helper instead clears BLOCK_HAVE_DATA before lookup and never deletes a file, while the functional tests finish pruneblockchain before querying. Those cases take the earlier missing-data path. Add a deterministic test that pauses after candidate collection, prunes and unlinks the candidate's file, then resumes and asserts that TxMiss::pruned_block_hashes contains the active-chain block hash rather than throwing. This requires a test-only synchronization seam to force the rare interleaving.
[suggestion] · PSBT update documentation omits pruned-transaction recovery
PSBT updates retain their existing partial-update behavior with pruning, but the documentation does not explain that -prune plus -txindex can leave non_witness_utxo unset without returning recovery hashes.
Location: src/rpc/rawtransaction.cpp:180 (head).
Details and suggested fix
ProcessPSBT, shared by utxoupdatepsbt and descriptorprocesspsbt, ignores pruned_block_hashes on a TxMiss. Its UTXO fallback can still fill witness_utxo for unspent segwit outputs, but cannot supply the full previous transaction. The new functional test asserts that a legacy input lacks non_witness_utxo until its block is fetched. Add a release-note sentence explaining this limitation and recovery: callers needing the previous transaction can query getrawtransaction for candidate block hashes, fetch them with getblockfrompeer, and retry the PSBT update. The existing partial-update semantics and return types can stay unchanged.
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Unresolved disagreements
Historical participants disagreed about the usefulness of partial transaction availability. Objections emphasized that applications could no longer rely on getrawtransaction succeeding and would need fallback logic; proponents described manually managed pruning and recent-history applications where that limitation was acceptable. The inspected record does not resolve that product tradeoff.
Explicit recovery hints address ambiguity and enable a retry workflow, but do not recreate the archival availability expectation underlying those objections. These are historical concerns, not evidence for or against the current PR.
Source 1 · Source 2 · Source 3 · Source 4
The preceding hashed-index discussion left a privacy tradeoff unresolved. One position emphasized that block fetching avoids disclosing the exact txid to a public service; another emphasized that selective historical block requests still reveal interests and that getblockfrompeer users form a small anonymity set. Trusted sources and decoy requests were discussed as relevant defenses.
Surfacing candidate hashes enables caller-controlled fetching rather than making recovery automatic, but does not itself provide a privacy guarantee for the resulting requests.