HomePhabricator

[p2p] Reduce addr blackholes

Description

[p2p] Reduce addr blackholes

Summary:

This PR aims to reduce addr blackholes. When we receive an addr message that contains 10 or less addresses, we forward them to 1-2 peers. This is the main technique we use for self advertisements, so sending to peers that wouldn't relay would effectively "blackhole" the trickle. Although we cannot prevent this in a malicious case, we can improve it for the normal, honest cases, and reduce the overall likelihood of occurrence. Two known cases where peers would not participate in addr relay are if they have connected to you as a block-relay-only connection, or if they are a light client.

This implementation defers initialization of m_addr_known until it is needed, then uses its presence to decide if the peer is participating in addr relay. For outbound (not block-relay-only) peers, we initialize the filter before sending the initial self announcement when processing their version message. For inbound peers, we initialize the filter if/when we get an addr related message (ADDR, ADDRV2, GETADDR). We do NOT initialize the filter based on a SENDADDRV2 message.

Backport of core#21528.

Ref T1696.

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, tyler-smith

Reviewed By: #bitcoin_abc, tyler-smith

Subscribers: tyler-smith

Maniphest Tasks: T1696

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

Details

Provenance
Amiti Uttarwar <amiti@uttarwar.org>Authored on Mar 22 2021, 22:48
FabienCommitted on Jan 28 2022, 19:16
FabienPushed on Jan 28 2022, 19:16
Reviewer
Restricted Project
Differential Revision
D10933: [p2p] Reduce addr blackholes
Parents
rABC08e108695c3d: [avalanche] Add send_proof test helper.
Branches
Unknown
Tags
Unknown
Tasks
Restricted Maniphest Task

Event Timeline

Fabien added a task: Restricted Maniphest Task.