Page MenuHomePhabricator

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

Authored by PiRK on Nov 30 2022, 16:28.

Details

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