HomePhabricator

[net] Consistently check for existing connection based on ip:port

Description

[net] Consistently check for existing connection based on ip:port

Summary: The current implementation of AlreadyConnectedToAddress uses 2 methods to determine if the node is already connected to the candidate. First it searches by ip address (CNetAddr) then by ip:port (ToStringIPPort()). The first one is inconsistent with the other places in the codebase, and inconsistent with how addrman stores the peers data (based on CService, which is an ip:port object). This piece of code will prevent the node from connecting several nodes sharing the same ip but with a different port via outbound connections, which is not really a problem for core as it has a limited number of outbounds, but becomes a problem for eCash with avalanche where we should be able to connect all the peers.

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

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

Details

Provenance
FabienAuthored on Apr 2 2024, 10:11
FabienPushed on Apr 3 2024, 08:20
Reviewer
Restricted Project
Differential Revision
D15850: [net] Consistently check for existing connection based on ip:port
Parents
rABCdfe9f2069947: [avalanche] Increase the delay for a proof to be eligible to staking rewards
Branches
Unknown
Tags
Unknown