If the following two events happen:
- (likely) the automatic 10 initial connections are not made to all networks
- (unlikely) the network-specific logic kicks in almost immediately.
It is using exponential distribution with a mean of 5 minutes
(
rng.rand_exp_duration(EXTRA_NETWORK_PEER_INTERVAL)).
So if both happen, then the 11th connection may not be the expected private broadcast, but a network-specific connection.
Fix this by retrieving the connection type from
destinations_factory(). This is more flexible because it allows
connections to happen in any order and does not break if e.g. the 11th
connection is not the expected first private broadcast.
This also makes the test run faster: before: 19-44 sec now: 10-25 sec because for example there is no need to wait for the initial 10 automatic outbound connections to be made in order to proceed.
Fixes: #34387