Page MenuHomePhabricator

Protect localhost and block-relay-only peers from eviction
ClosedPublic

Authored by Fabien on Jun 14 2021, 14:18.

Details

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

Diff Detail

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