Commit cb65ac4
committed
Merge bitcoin#29605: net: Favor peers from addrman over fetching seednodes
6eeb188 test: adds seednode functional tests (Sergi Delgado Segura)
3270f0a net: Favor peers from addrman over fetching seednodes (Sergi Delgado Segura)
Pull request description:
This is a follow-up of bitcoin#28016 motivated by bitcoin#28016 (review) and bitcoin#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
ACKs for top commit:
achow101:
ACK 6eeb188
cbergqvist:
ACK 6eeb188
itornaza:
Tested ACK 6eeb188
tdb3:
ACK 6eeb188
Tree-SHA512: b04445412f22018852d6bef4d3f1e88425ee6ddb434f61dcffa9e0c41b8e31f8c56f83858d5c7686289c86dc4c9476c437df15ea61a47082e2bb2e073cc62f15File tree
4 files changed
+92
-9
lines changed- src
- test/functional
4 files changed
+92
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
2179 | 2182 | | |
2180 | 2183 | | |
2181 | 2184 | | |
2182 | | - | |
2183 | 2185 | | |
2184 | 2186 | | |
2185 | 2187 | | |
| |||
2198 | 2200 | | |
2199 | 2201 | | |
2200 | 2202 | | |
2201 | | - | |
| 2203 | + | |
2202 | 2204 | | |
2203 | 2205 | | |
2204 | 2206 | | |
| |||
2221 | 2223 | | |
2222 | 2224 | | |
2223 | 2225 | | |
2224 | | - | |
| 2226 | + | |
2225 | 2227 | | |
2226 | 2228 | | |
2227 | 2229 | | |
| |||
2252 | 2254 | | |
2253 | 2255 | | |
2254 | 2256 | | |
2255 | | - | |
| 2257 | + | |
2256 | 2258 | | |
2257 | 2259 | | |
2258 | 2260 | | |
| |||
2447 | 2449 | | |
2448 | 2450 | | |
2449 | 2451 | | |
2450 | | - | |
| 2452 | + | |
2451 | 2453 | | |
2452 | 2454 | | |
2453 | 2455 | | |
| |||
2487 | 2489 | | |
2488 | 2490 | | |
2489 | 2491 | | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
2490 | 2496 | | |
2491 | 2497 | | |
2492 | 2498 | | |
2493 | 2499 | | |
2494 | 2500 | | |
2495 | 2501 | | |
| 2502 | + | |
| 2503 | + | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + | |
2496 | 2514 | | |
2497 | 2515 | | |
2498 | 2516 | | |
| |||
2593 | 2611 | | |
2594 | 2612 | | |
2595 | 2613 | | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
2596 | 2621 | | |
2597 | 2622 | | |
2598 | 2623 | | |
| |||
3249 | 3274 | | |
3250 | 3275 | | |
3251 | 3276 | | |
3252 | | - | |
3253 | | - | |
| 3277 | + | |
| 3278 | + | |
| 3279 | + | |
| 3280 | + | |
3254 | 3281 | | |
3255 | 3282 | | |
3256 | 3283 | | |
| |||
3311 | 3338 | | |
3312 | 3339 | | |
3313 | 3340 | | |
3314 | | - | |
| 3341 | + | |
3315 | 3342 | | |
3316 | 3343 | | |
3317 | 3344 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1273 | 1273 | | |
1274 | 1274 | | |
1275 | 1275 | | |
1276 | | - | |
| 1276 | + | |
1277 | 1277 | | |
1278 | 1278 | | |
1279 | 1279 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
| 409 | + | |
409 | 410 | | |
410 | 411 | | |
411 | 412 | | |
| |||
0 commit comments