HomePhabricator

fix incorrect blk file size calculation during reindex

Description

fix incorrect blk file size calculation during reindex

Summary:
This fixes a blk file size calculation made during reindex that results in increased blk file malformity.
The fix is to avoid double counting the size of the serialization header during reindex.
This adds a unit test to reproduce the bug before the fix and to ensure that it does not recur.
These changes include a log message change also so as to not be as alarming. This is a common and recoverable
data corruption. These messages can now be filtered by the debug log reindex category.

This is a backport of core#24858

Depends on D14995

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14996

Details

Provenance
mruddy <6440430+mruddy@users.noreply.github.com>Authored on Apr 14 2022, 22:44
PiRKCommitted on Dec 18 2023, 09:07
PiRKPushed on Dec 18 2023, 09:07
Reviewer
Restricted Project
Differential Revision
D14996: fix incorrect blk file size calculation during reindex
Parents
rABCdb99dc1ba87d: assumeutxo: catch and log fs::remove error instead of two exist checks
Branches
Unknown
Tags
Unknown