resolves #29618.
This PR adds a config flag option -v2onlyclearnet
which disallows v1 connections on ipv4 and ipv6 networks since they’re unencrypted. v1 connections are still possible from tor/i2p/cjdns peers since they’re encrypted networks.
- v1 outbound connections to peers are not attempted
- v1 reconnections are not attempted (if peer is falsely advertised as v2 peer and we attempt a v2 connection but it fails, we do not attempt a v1 reconnection when
-v2onlyclearnet
is switched on) - v1 inbound connections are immediately disconnected
Currently 59.71% of network supports v2 (according to https://bitnodes.io/nodes) so don’t see risk of network partition with the option set as default off. Also found 41-45 % of addresses supporting v2 in the addrman of nodes I checked - personal node and the nodes in peer.observer. (You can use this branch to check the % of v2 addresses in a node’s addrman.)