This is a follow-up of #28016 motivated by #28016#pullrequestreview-1913140932 and #28016 (comment).
The current behavior of seednode fetching is pretty eager: we do it as the first step under ThreadOpenNetworkConnections
even if some peers may be queryable from our addrman. This poses two potential issues:
- First, if permanently set (e.g. running with seednode in a config file) we’d be signaling such seed every time we restart our node
- Second, we will be giving the seed node way too much influence over our addrman, populating the latter with data from the former even when unnecessary
This changes the behavior to only add seednodes to m_addr_fetch
if our addrman is empty, or little by little after we’ve spent some time trying addresses from our addrman. Also, seednodes are added to m_addr_fetch
in random order, to avoid signaling the same node in case more than one seed is added and we happen to try them over multiple restarts