Page MenuHomePhabricator

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

Authored by Fabien on Apr 2 2024, 11:36.

Details

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

Diff Detail