HomePhabricator

Protect localhost and block-relay-only peers from eviction

Description

Protect localhost and block-relay-only peers from eviction

Summary:

Onion peers are disadvantaged under our eviction criteria, so prevent
eventual eviction of them in the presence of contention for inbound
slots by reserving some slots for localhost peers (sorted by longest
uptime).

Block-relay-only connections exist as a protection against eclipse
attacks, by creating a path for block propagation that may be unknown to
adversaries. Protect against inbound peer connection slot attacks from
disconnecting such peers by attempting to protect up to 8 peers that are
not relaying transactions but appear to be full-nodes, sorted by recency
of last delivered block.

Backport of core#19670.

Note that tests will be added when porting this PR:
https://github.com/bitcoin/bitcoin/pull/20477

Ref T1611.

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Maniphest Tasks: T1611

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

Details

Provenance
Suhas Daftuar <sdaftuar@gmail.com>Authored on Aug 5 2020, 18:31
FabienCommitted on Jun 15 2021, 06:11
FabienPushed on Jun 15 2021, 06:12
Reviewer
Restricted Project
Differential Revision
D9676: Protect localhost and block-relay-only peers from eviction
Parents
rABCa668273790a0: [avalanche] Check the delegation generated at startup is valid
Branches
Unknown
Tags
Unknown
Tasks
Restricted Maniphest Task