This is an alternative to #22112. They are mutually exclusive. Just one of them should be merged.
Background
Listening for incoming connections in I2P does not involve a port - we just listen on an address. Similarly we just connect to an I2P address, without a port (this is in I2P SAM 3.1, what’s used in Bitcoin Core).
Problem
It is possible to connect to the same node multiple times if different ports are used.
Solution
For I2P addresses:
- Ignore ports when comparing
CService
objects - Do not print ports in
CService::ToString()
- Strip ports from user-input addresses - this helps to detect duplicates earlier (by
CConnMan::FindNode(std::string)
) and to print without the ports in the cases where we print the user input without converting it toCService
object and using itsToString()
method