3 suggestions
Earlier concerns neither republished nor resolved: 2 suggestions. See the Run archive for their assessments.
Optional improvements
[suggestion] · Fetch-and-retry guidance omits retention and peer-disclosure caveats
The new getrawtransaction and gettxoutproof recovery guidance omits that manually fetched blocks can be re-pruned before retry and that the chosen peer learns which historical block was requested.
Location: src/rpc/rawtransaction.cpp:263 (head).
Details and suggested fix
getblockfrompeer already warns that a received block can be re-pruned immediately. Block-file metadata records original block heights, not arrival time. Sharing a file with recent blocks can protect a small refetch, but bulk fetching can roll a file containing only old blocks. That file becomes eligible for automatic pruning when the storage target is exceeded, even without advancing the tip, so fetching every candidate need not leave the required body available for the retry. Add this best-effort retention caveat to both lookup help texts and the release note. Also explain that getblockfrompeer sends the exact requested block hash to the chosen peer and recommend a trusted peer for privacy-sensitive lookups.
[suggestion] · The series enables pruning before pruned lookups are handled
The intermediate commit enabling -prune with -txindex still labels an ordinary pruned lookup as data corruption; later commits fix this, making it a series review-flow issue rather than a head defect.
Location: src/init.cpp:1033 at 66810d2a74b9 (parent of ef380b48a65e) (commit).
Details and suggested fix
Commit ef380b48a65e3c4ab990256f754d17262735e4bc, whose direct parent is 66810d2a74b91cfb2927dc7f96e72b89fe407e29, removes the startup prohibition for nonlegacy indexes while its FindTx still logs Caused by data corruption? and throws for pruned active-chain blocks. Commit 30916d4f870227bf9a23032db8c36a1d440bd190 adds pruning-aware lookup results, and 63ecdaec0a3831db9b17d0d40adfc71bb18ef7c3 propagates them through GetTransaction to RPC and REST callers. Move the enabling commit after those two commits, retaining its legacy-entry and historical-data guards and associated enablement tests. The lookup unit tests set pruning state directly, so they do not require startup enablement. This would let reviewers validate the newly enabled mode without reading ahead to understand why ordinary pruning produces a corruption warning, while leaving the final tree unchanged.
[suggestion] · Legacy-index startup advice omits the non-rebuilding option
When no blocks have been pruned, disabling pruning preserves the legacy index, but the startup error offers only deleting and rebuilding it without naming the directory.
Location: src/init.cpp:2020 (head).
Details and suggested fix
This branch runs only when m_have_pruned is false. The rejection of returning to unpruned mode in CompleteChainstateInitialization therefore does not apply, so users can keep their existing index by restarting with pruning disabled. Include that option alongside rebuilding, and format the error with the resolved network-specific indexes/txindex path. The constructor already logs the path through TxIndexDBPath(), but users should not need a separate log message to follow the startup error. Drop Stop the node as well, since startup is already aborting, and update the compatibility test's expected message.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Prune-race recovery lacks deterministic test coverage (earlier report)
- [suggestion]: PSBT updaters omit pruned-block recovery guidance (earlier report)
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Documented decisions
Pruning was designed to discard block and undo files while retaining enough recent chain history for ordinary operation, not to preserve archival transaction access. The original proposal protected the last 288 main-chain blocks, described the storage target as best-effort, and explicitly noted that reorgs deeper than retained data were not handled.
The relevant invariant is preservation of validation state and recent chain history, not perpetual availability of every indexed transaction. The historical 288-block rule concerns recent main-chain blocks; it does not establish a fresh 288-block retention period for an old block downloaded again.
Historical requests distinguished transaction absence from local data unavailability. #10609 observed that a pruned node could not distinguish a nonexistent txid from one whose transaction had been pruned, and proposed retaining approximate membership information even if it produced false positives.
This supports treating a hashed-index match into missing data as uncertainty rather than a verified transaction location or a definitive miss. Returning candidate block hashes preserves useful information without asserting that those blocks contain the requested transaction.
The hashed index deliberately traded exact keys for smaller storage while preserving exact successful answers: #35531 proposed five-byte salted hashes, scanning all matching candidates, and resolving collisions by reading, deserializing, and hashing the actual transaction. Its stated collision penalty was extra reads, not acceptance of an approximate match.
Pruning removes the data needed to perform that final identity check. A missing candidate therefore remains a possible match, while a readable candidate can still be rejected or confirmed by its full txid. The pinned head retains this full-txid check before returning a transaction.
Logical block identity and graceful legacy compatibility were intentional design choices. #12651 proposed replacing physical block positions with block hashes so missing bodies could be fetched from peers. #35531 introduced sequence-to-block-hash indirection but explicitly kept existing full-txid entries readable through fallback; upgrading did not force their conversion.
An upgraded database can remain mixed-format indefinitely. New entries’ ability to survive block relocation does not confer that ability on old entries. The historical optional rebuild for space savings is distinct from the current requirement to eliminate legacy entries before permitting pruning.
Source 1 · Source 2 · Source 3
Index recovery requirements were deliberately made index-specific. #29770 states that blockfilterindex and coinstatsindex need undo data as well as bodies, and that startup should reject an insufficient history instead of beginning synchronization and failing later. Its author explicitly defended recording txindex’s lack of an undo requirement, including for possible future pruning support.
Restoring all required block bodies can make txindex resumable without restoring undo data. It does not provide the same recovery guarantee for indexes whose connection processing consumes undo. The pinned base already checks these requirements separately, from each index’s saved chain position or fork point.
getblockfrompeer was introduced as an attempt to fetch a specified block, including stale blocks, rather than as guaranteed archival recovery. Subsequent work explicitly documented that fetched blocks have no undo data and that their availability is temporary. Fetching ahead of a pruned node’s synchronization height was restricted because it could pin whole files and substantially exceed the storage target.
The pinned RPC requires an existing header, returns success when the request is scheduled, warns about peer serving limitations, and says the block could be re-pruned immediately. Recovery is therefore conditional on successful receipt and continued local availability; restoring a body does not restore all operations that require undo.
Source 1 · Source 2 · Source 3 · Source 4
Ralph's inferences
The legacy pruning barrier protects recoverable identity, not merely successful disk reads. Legacy entries contain a physical position and recover the containing block hash by reading its header. Once that file is deleted, the legacy entry alone cannot identify the block to request or locate a subsequently relocated copy.
This explains the head’s two rebuild paths: deleting and rebuilding only txindex when historical bodies remain, versus full reindex and redownload when they do not. It also explains requiring complete genesis-to-tip bodies for a new index: indexing only retained history would silently change its coverage.
Active-chain preference is a separate property from transaction identity. The base retains stale entries and orders candidates by active-chain membership before connection sequence. With pruning, a readable stale copy cannot resolve whether an unreadable active-chain candidate contains the same transaction, because that candidate may be either a duplicate or a hash collision.
The head conservatively returns uncertainty before using stale candidates whenever active-chain candidates remain pruned. This preserves the existing preference rather than letting disk availability silently choose the branch. Conversely, readable active candidates still require an exact txid match. This matters especially for multi-transaction proofs, where locating one transaction in a stale block does not locate the entire requested set.
Resuming an index and answering one lookup have different completeness requirements. Resume checks the entire required interval from the saved position or common ancestor to the current tip. A transaction lookup can succeed from one restored body. Waiting for index synchronization is also conditional: the interface only waits for queued updates after the index has synchronized once, not for arbitrary historical catch-up.
Fetching one reported block can repair a transaction lookup without repairing a lagging index. Txindex recovery requires all bodies in its synchronization interval, while undo-dependent indexes need both kinds of data. A lookup miss during catch-up is not equivalent to a complete historical absence claim.
Body availability, confirmation status, and undo-derived enrichment are independent. Raw transaction bytes and PSBT non_witness_utxo can be obtained from a readable transaction body; Merkle proof construction needs the containing block and verifies that every requested txid is present. Fee and prevout enrichment uses undo. Proof verification separately checks active-chain membership.
After a successful refetch, body-backed transaction, REST, proof, and full-previous-transaction PSBT lookups can recover without undo. That does not imply fee/prevout availability or that a stale-block proof will verify against the active chain. The existing PSBT path is best-effort: when the full previous transaction is unavailable, it falls back to UTXO data only for recognized SegWit outputs.
Unresolved disagreements
The historical record contains competing views about the usefulness of partial transaction availability. In #16182, objections emphasized unstable application behavior, required fallbacks, and the unacceptable cost of scanning retained blocks without an index. A counterposition argued that manual pruning is useful when the operator knows which history is no longer needed. #12651 also contrasted local indexing plus block fetching with applications supplying transaction inclusion proofs.
These are API and deployment tradeoffs, not evidence against the present implementation. Explicit missing-block information addresses ambiguity, but does not make a pruned node an always-available transaction service or remove applications’ recovery responsibilities. The inspected record does not establish a resolution of those broader preferences.