HomePhabricator

net processing: Remove nStartingHeight check from block relay

Description

net processing: Remove nStartingHeight check from block relay

Summary:

nStartingHeight was introduced in commit 7a47324 (Bitcoin version
0.2.9, P2P version 209) with the comment "better prevention of inventory relaying during initial download". At that time, there was no function to determine whether the node was still in Initial Block Download, so to prevent syncing nodes from relaying old blocks to their peers, a check was added to never relay a block to a peer where the height was lower than 2000 less than the peer's best block. That check was updated several times in later commits to ensure that we weren't relaying blocks before the latest checkpoint if the peer didn't provide a
startingheight. The checkpoint comparison was changed to compare with an estimate of the highest block in commit eae82d8.

In commit 202e019, all block relay was gated on being out of Initial
Block Download. In commit 0278fb5, the comparison to nBlockEstimate was removed since "we already checked IsIBD()".

We can remove the check against nStartingHeight entirely. If the node is out of Initial Block Download, then its tip height must have been within 24 hours of current time, so should not be more than ~144 blocks behind the most work tip.

Backport of core#20624.

Depends on D10862.

Ref T1696.

Test Plan:

ninja all check-all

Run IBD

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Maniphest Tasks: T1696

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

Details

Provenance
John Newbery <john@johnnewbery.com>Authored on Dec 11 2020, 10:08
FabienCommitted on Jan 24 2022, 08:24
FabienPushed on Jan 24 2022, 08:24
Reviewer
Restricted Project
Differential Revision
D10863: net processing: Remove nStartingHeight check from block relay
Parents
rABC507b5a05ef9e: net processing: Move peer_map to PeerManager
Branches
Unknown
Tags
Unknown
Tasks
Restricted Maniphest Task