Follow up for #27264.
In order to make sure that our persistent outbound slots belong to different netgroups, distinct net groups of our peers are added to setConnected
. We’d only open a persistent outbound connection to peers which have a different netgroup compared to those netgroups present in setConnected
.
Current GetGroup()
logic assumes route-based diversification behaviour for tor/i2p/cjdns addresses (addresses are public key based and not route-based). Distinct netgroups possible (according to the current GetGroup()
logic) for:
- tor => 030f, 031f, .. 03ff (16 possibilities)
- i2p => 040f, 041f, .. 04ff (16 possibilities)
- cjdns => 05fc0f, 05fc1f, … 05fcff (16 possibilities)
setConnected
is used in ThreadOpenConnections()
before making outbound and anchor connections to new peers so that they belong to distinct netgroups.
behaviour on master
- if we run a node only on tor/i2p/cjdns
- we wouldn’t be able to open more than 16 outbound connections(manual, block-relay-only anchor, outbound full relay, block-relay-only connections) because we run out of possible netgroups.
- see #27264 (comment)
- tested by changing
MAX_OUTBOUND_FULL_RELAY_CONNECTIONS
to 17 withonlynet=onion
and observed how node wouldn’t make more than 16 outbound connections.
behaviour on PR
- netgroup diversity checks are skipped for tor/i2p/cjdns addresses.
- we don’t insert tor/i2p/cjdns address in
setConnected
andGetGroup
doesn’t get called on tor/i2p/cjdns(see #27369)