HomePhabricator

Move additional headers fetching to own function

Description

Move additional headers fetching to own function

Summary:
Also moves the call to happen directly after validation of a headers message
(rather than mixed in with other state updates for the peer), and removes an
incorrect comment in favor of one that explains why headers sync must continue
from the last header a peer has sent.

This is a backport of core#25454
https://github.com/bitcoin/bitcoin/pull/25454/commits/bf8ea6df75749c27f753b562c4724b3f8d263ad4

Depends on D14907

Note that FetchMoreHeaders requires the cs_main lock to be held because of the use of ActiveChain(). This is needed in the local scope because of the lock splitting in D9591.

Test Plan:
With clang and debug:
ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
Suhas Daftuar <sdaftuar@gmail.com>Authored on Feb 8 2022, 22:15
PiRKCommitted on Dec 5 2023, 18:25
PiRKPushed on Dec 5 2023, 18:25
Reviewer
Restricted Project
Differential Revision
D14908: Move additional headers fetching to own function
Parents
rABC5ccc844d0075: Add helper function for checking header continuity
Branches
Unknown
Tags
Unknown