Page MenuHomePhabricator

net processing: Remove nStartingHeight check from block relay
ClosedPublic

Authored by Fabien on Jan 21 2022, 14:28.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Maniphest Tasks
Restricted Maniphest Task
Commits
rABC929af2da8426: 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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable