HomePhabricator

net: don't relay to the address' originator

Description

net: don't relay to the address' originator

Summary:

For each address to be relayed we "randomly" pick 2 nodes to send the address to (in `RelayAddress()`). However we do not take into consideration that it does not make sense to relay the address back to its originator (`CNode::PushAddress()` will do nothing in that case).

This means that if the originator is among the "randomly" picked nodes, then we will relay to one node less than intended.

Fix this by skipping the originating node when choosing candidates to relay to.

Backport of core#19763.

Depends on D10859.

Ref T1696.

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Maniphest Tasks: T1696

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

Details

Provenance
Vasil Dimov <vd@FreeBSD.org>Authored on Aug 18 2020, 19:30
FabienCommitted on Jan 21 2022, 13:17
FabienPushed on Jan 21 2022, 13:17
Reviewer
Restricted Project
Differential Revision
D10860: net: don't relay to the address' originator
Parents
rABCe146f1646307: Clear m_addr_known before our periodic self-advertisement
Branches
Unknown
Tags
Unknown
Tasks
Restricted Maniphest Task

Event Timeline