HomePhabricator

[net processing] Remove unnecessary hash arg from MarkBlockAsInFlight()

Description

[net processing] Remove unnecessary hash arg from MarkBlockAsInFlight()

Summary:
PR description:

The QueuedBlock struct contains a fValidatedHeaders field that indicates whether we have already validated a header for the requested block. Since headers-first syncing, we only request blocks where the header is already validated, so fValidatedHeaders is always true. Remove it and clean up the logic that uses that field.

Likewise, QueuedBlock contains a hash field that is set to the block hash. Since headers-first syncing, we always have a CBlockIndex, which contains the block hash, so remove the redundant hash field.

Tidy up the logic and rename functions to better indicate what they're doing.

MarkBlockAsInFlight is always called with a non-null pindex. Just get the block hash
from that pindex inside the function.

This is a partial backport of core#22141
https://github.com/bitcoin/bitcoin/pull/22141/commits/85e058b19145b5068f2f71a90c1182bf2a93c473

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, sdulfari

Reviewed By: #bitcoin_abc, sdulfari

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

Details

Provenance
John Newbery <john@johnnewbery.com>Authored on Jun 3 2021, 11:33
PiRKCommitted on Dec 1 2022, 07:46
PiRKPushed on Dec 1 2022, 07:46
Reviewer
Restricted Project
Differential Revision
D12702: [net processing] Remove unnecessary hash arg from MarkBlockAsInFlight()
Parents
rABCae37905b45e2: [Automated] Update timing.json
Branches
Unknown
Tags
Unknown