Skip to content

Fix spurious ABLA-related warning for pruned nodes

Calin Culianu requested to merge cculianu/bitcoin-cash-node:fix_525 into master

Summary

This fixes #525. The issue is that as part of normal operation the node tries to read block sizes form block files as a sanity check.

Failure here is ok, and even expected on pruned nodes. In the pruned-node case, it just means we simply "trust" whatever is stored in the ABLA state in CBlockIndex and don't/can't sanity-check it versus disk files. This is fine.

However, normal operation was producing spurious warnings to the log file when attempting to open non-existant block files in the pruned-node case. See issue #525.

The fix is to pass a boolean into ReadBlockSizeCommon to suppress the warning if blockPos.IsNull() (which is the case for pruned blocks).

The only code path that was triggering this error was all in the ABLA code paths and they are totally ok with missing files, so the warning appearing in the log was spurious and unnecessary.

Test Plan

  • ninja all check-all

Optional:

  • See if you can reproduce the issue in #525 against master
    • Start a pruned node on mainnet, set pruning to very small -prune=550.
    • After node fully synchs, stop the node and restart it.
    • Observe warnings about inabilty to open some block files at node startup. (See issue #525 for an example).
  • If you can reproduce, then switch to this MR's branch and see that this MR fixes the issue.
Edited by Calin Culianu

Merge request reports