1 minor finding · 1 suggestion
Earlier concerns neither republished nor resolved: 2 suggestions. See the Run archive for their assessments.
Findings
[minor] · FatalError assignments discard existing failure details
Replacing an already-failed state after local block corruption or a reorg flush failure removes diagnostic details from logs, callbacks or RPC errors without changing failure returns or shutdown behavior.
Location: src/validation.cpp:2397 (head).
Details and suggested fix
Error() previously preserved the result, reject reason and debug message when state was already non-valid; assigning the fresh MakeError() state discards them. In ConnectBlock, stored transaction corruption that still deserializes under an intact header can pass ReadBlock, which resets the cached-check flags but does not verify the merkle root. If CheckBlock returns BLOCK_MUTATED, this assignment replaces its specific merkle failure with the generic hardware-failure message and BLOCK_RESULT_UNSET before ConnectTip logs it or sends BlockChecked. Kernel result getters consequently report UNSET instead of MUTATED. In ActivateBestChainStep, a failed IF_NEEDED flush returned by DisconnectTip is similarly replaced with "Failed to disconnect block.", so the subsequent activation log and RPC errors lose the flush reason even though its notification retains it. Preserve the state at both sites by sending fatalError(message) and then calling state.Error(message.original) instead of assigning a fresh state. Keep the fatal notification even for an existing Error: a block-file flush failure may previously have emitted only flushError(). No production occurrence was identified.
Optional improvements
[suggestion] · Stale TestBlockValidity comment labels normal rejections as impossible
With the boolean/state consistency guard removed, the comment now describes a normal CheckBlock rejection as something that should never happen.
Location: src/validation.cpp:4594 (head).
Details and suggested fix
The comment used to explain the defensive if (state.IsValid()) NONFATAL_UNREACHABLE() check inside the failed boolean-return branch. This PR removes that check, leaving only return state under !state.IsValid(). A decoded getblocktemplate proposal extending the current tip can normally reach this return, for example with an incorrect merkle root because proposal mode enables check_merkle_root. Delete the two comment lines along with the removed guard; this preserves rejection behavior.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Keep factory definitions out of the widely included validation header
- [suggestion]: Commit message inaccurately describes a kernel C API change (earlier report)