-seednode
is an alternative bootstrap mechanism - when choosing it, we make a AddrFetch
connection to the specified peer, gather addresses from them, and then disconnect. Presumably, if users specify a seednode they prefer addresses from that node over fixed seeds.
However, when disabling dns seeds and specifiying -seednode
, CConnman::ProcessAddrFetch()
immediately removes the entry from m_addr_fetches
(before the seednode could give us addresses) - and once m_addr_fetches
is empty, ThreadOpenConnections
will add fixed seeds, resulting in a “race” between the fixed seeds and seednodes filling up AddrMan.
This PR suggests to check for any provided -seednode
arg instead of using the size of m_addr_fetches
, thus delaying the querying of fixed seeds for 1 minute when specifying any seednode (as we already do for addnode
peers).
That way, we actually give the seednodes a chance for to provide us with addresses before falling back to fixed seeds.
This can be tested with bitcoind -debug=net -dnsseed=0 -seednode=(...)
on a node without peers.dat
and observing the debug log.