This is an alternative to #21514, inspired by #21514 (comment). They are mutually exclusive. Just one of them should be merged.
Change assumed ports for I2P to 0 (instead of the default 8333) as this is closer to what actually happens underneath with SAM 3.1 (https://github.com/bitcoin/bitcoin/pull/21514#issuecomment-812632520, #21514 (comment)).
Don’t connect to I2P peers with advertised port != 0 (we don’t specify a port to our SAM 3.1 proxy and it always connects to port = 0).
Note, this change:
Keeps I2P addresses with port != 0 in addrman and relays them to others via P2P gossip. There may be non-bitcoin-core-22.0 peers using SAM 3.2 and for them such addresses may be useful.Edit: last commit amends that behavior to change all ports to 0 in addrman. There are no peers using SAM 3.2 yet and we need to be able to connect to existent peers that are already saved in addrman with port 8333.- Silently refuses to connect to I2P hosts with port != 0. This is ok for automatically chosen peers from addrman. Not so ok for peers provided via
-addnode
or-connect
- a user who specifiesfoo.b32.i2p:1234
(non zero port) may wonder why “nothing is happening”.
Fixes #21389