Page MenuHomePhabricator

Respond to getheaders if we have sufficient chainwork
ClosedPublic

Authored by PiRK on Nov 30 2023, 14:25.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC30ec88a3b605: Respond to getheaders if we have sufficient chainwork
Summary

Previously, we would check to see if we were in IBD and ignore getheaders
requests accordingly. However, the IBD criteria -- an optimization mostly
targeted at behavior when we have peers serving us many blocks we need to
download -- is difficult to reason about in edge-case scenarios, such as if the
network were to go a long time without any blocks found and nodes getting
restarted during that time.

To make things simpler to reason about, just use nMinimumChainWork as our
anti-DoS threshold; as long as our chain has that much work, it should be fine
to respond to a peer asking for our headers (and this should allow such a peer
to request blocks from us if needed).

This is a backport of core#24178

Test Plan

ninja all check-all

Run an IBD