Page MenuHomePhabricator

Sync chain more readily from inbound peers during IBD
ClosedPublic

Authored by PiRK on Nov 30 2023, 15:18.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC1c49e46058ad: Sync chain more readily from inbound peers during IBD
Summary

When in IBD, if the honest chain is only known by inbound peers, then we must
eventually sync from them in order to learn it. This change allows us to
perform initial headers sync and fetch blocks from inbound peers, if we have no
blocks in flight.

The restriction on having no blocks in flight means that we will naturally
throttle our block downloads to any such inbound peers that we may be
downloading from, until we leave IBD. This is a tradeoff between preferring
outbound peers for most of our block download, versus making sure we always
eventually will get blocks we need that are only known by inbound peers even
during IBD, as otherwise we may be stuck in IBD indefinitely (which could have
cascading failure on the network, if a large fraction of the network managed to
get stuck in IBD).

This is a backport of core#24171

Depends on D14882

Test Plan

ninja all check-all

I also ran the test on its own to check that it fails before this change.

Run IBD

Event Timeline

PiRK published this revision for review.Nov 30 2023, 17:09

How does it impact protection against eclipse attacks ?

How does it impact protection against eclipse attacks ?

We already download blocks and headers from inbound peers if we don't have any outbound peer. So the situation after this diff is not very different if we have only unresponsive outbound peers and responsive inbound peers. We use the inbounds as a plan B until an outbound peer becomes responsive again.

This revision is now accepted and ready to land.Dec 3 2023, 11:18