Ava Chow cb65ac469a
Merge bitcoin/bitcoin#29605: net: Favor peers from addrman over fetching seednodes
6eeb188d40fe8f6c3b0a3be6dca519ea9a7b2358 test: adds seednode functional tests (Sergi Delgado Segura)
3270f0adad6ccbb8c004fb222f420e9b3ea32ea6 net: Favor peers from addrman over fetching seednodes (Sergi Delgado Segura)

Pull request description:

  This is a follow-up of #28016 motivated by https://github.com/bitcoin/bitcoin/pull/28016#pullrequestreview-1913140932 and https://github.com/bitcoin/bitcoin/pull/28016#issuecomment-1984448937.

  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

ACKs for top commit:
  achow101:
    ACK 6eeb188d40fe8f6c3b0a3be6dca519ea9a7b2358
  cbergqvist:
    ACK 6eeb188d40fe8f6c3b0a3be6dca519ea9a7b2358
  itornaza:
    Tested ACK 6eeb188d40fe8f6c3b0a3be6dca519ea9a7b2358
  tdb3:
    ACK 6eeb188d40fe8f6c3b0a3be6dca519ea9a7b2358

Tree-SHA512: b04445412f22018852d6bef4d3f1e88425ee6ddb434f61dcffa9e0c41b8e31f8c56f83858d5c7686289c86dc4c9476c437df15ea61a47082e2bb2e073cc62f15
2024-09-04 13:15:08 -04:00
..
2024-07-08 11:12:01 +02:00
2024-08-29 13:49:57 +02:00
2024-04-10 17:01:27 +02:00
2024-08-29 13:49:57 +02:00
2024-08-06 01:38:10 +02:00
2024-08-06 01:38:10 +02:00
2024-06-13 11:20:49 +01:00
2024-08-06 01:38:10 +02:00
2023-11-16 11:36:22 +10:00
2024-08-29 13:49:57 +02:00
2024-07-24 15:57:01 +01:00
2024-08-04 08:51:36 +02:00
2023-09-13 11:37:45 +01:00
2024-05-20 16:48:19 +00:00
2024-07-08 11:12:01 +02:00
2024-08-29 13:49:57 +02:00
2024-07-08 11:12:01 +02:00
2024-08-29 13:49:57 +02:00
2024-04-01 14:37:24 -04:00
2024-07-08 11:12:01 +02:00
2024-07-08 11:12:01 +02:00
2024-08-29 13:49:57 +02:00
2023-11-16 11:36:22 +10:00