HomePhabricator

Periodically make block-relay connections and sync headers

Description

Periodically make block-relay connections and sync headers

Summary:

To make eclipse attacks more difficult, regularly initiate outbound connections
and stay connected long enough to sync headers and potentially learn of new
blocks. If we learn a new block, rotate out an existing block-relay peer in
favor of the new peer.

This augments the existing outbound peer rotation that exists -- currently we
make new full-relay connections when our tip is stale, which we disconnect
after waiting a small time to see if we learn a new block. As block-relay
connections use minimal bandwidth, we can make these connections regularly and
not just when our tip is stale.

Like feeler connections, these connections are not aggressive; whenever our
timer fires (once every 5 minutes on average), we'll try to initiate a new
block-relay connection as described, but if we fail to connect we just wait for
our timer to fire again before repeating with a new peer.

Backport of core#19858.

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/D10907

Details

Provenance
Suhas Daftuar <sdaftuar@gmail.com>Authored on Sep 1 2020, 20:32
FabienCommitted on Jan 26 2022, 19:34
FabienPushed on Jan 26 2022, 19:34
Reviewer
Restricted Project
Differential Revision
D10907: Periodically make block-relay connections and sync headers
Parents
rABCa2222e5090f6: Convert block/header sync timeouts to std::chrono types
Branches
Unknown
Tags
Unknown
Tasks
Restricted Maniphest Task