1 suggestion
Optional improvements
[suggestion] · FindTx iterator-error handling lacks regression coverage
The existing txindex and dbwrapper tests would not detect removal of the new status check, because none exercises iterator-error reporting.
Location: src/index/txindex.cpp:212 (head).
Details and suggested fix
The txindex fixtures exercise healthy scans. dbwrapper_read_throws_on_db_error damages compacted tables but checks only Read() and TryRead(), while dbwrapper_iterator checks exhaustion without checking status. Extend the corruption fixture to seek an iterator to the damaged entry and assert that CheckStatus() throws dbwrapper_error; also check that healthy exhaustion does not throw. To protect the production call, add an on-disk FindTx() reproducer that first retrieves an indexed transaction, then encounters a database error during the 'x' candidate scan and throws instead of returning nullopt, with a healthy miss as a control. Isolate the failure from the construction-time HasKeyStartingWith probe, salt reads, and BlockSeqKey point reads. Avoid cached tables and blocks, since fill_cache=false does not bypass existing cache entries. Coverage should also include an iterator that remains valid after skipping a damaged block: TwoLevelIterator retains that error, so a check guarded by !Valid() would miss it. If a deterministic FindTx test proves brittle, provide exact flush, damage, and cache-handling steps as a manual guide, as allowed by doc/developer-notes.md; the current PR description gives only a high-level experiment summary.