Commit 326a565
committed
Merge bitcoin#11456: Replace relevant services logic with a function suite.
15f5d3b Switch DNSSeed-needed metric to any-automatic-nodes, not services (Matt Corallo)
5ee88b4 Clarify docs for requirements/handling of addnode/connect nodes (Matt Corallo)
57edc0b Rename fAddnode to a more-descriptive "manual_connection" (Matt Corallo)
4440710 Replace relevant services logic with a function suite. (Matt Corallo)
Pull request description:
This was mostly written as a way to clean things up so that the NETWORK_LIMITED PR (bitcoin#10387) can be simplified a ton, but its also a nice standalone cleanup that will also require a bit of review because it tweaks a lot of stuff across net. The new functions are fine in protocol.h right now since they're straight-forward, but after NETWORK_LIMITED will really want to move elsewhere after @theuni moves the nServices-based selection to addrman from connman.
Adds HasAllRelevantServices and GetRelevantServices, which check
for NETWORK|WITNESS.
This changes the following:
* Removes nRelevantServices from CConnman, disconnecting it a bit
more from protocol-level logic.
* Replaces our sometimes-connect-to-!WITNESS-nodes logic with
simply always requiring WITNESS|NETWORK for outbound non-feeler
connections (feelers still only require NETWORK).
* This has the added benefit of removing nServicesExpected from
CNode - instead letting net_processing's VERSION message
handling simply check HasAllRelevantServices.
* This implies we believe WITNESS nodes to continue to be a
significant majority of nodes on the network, but also because
we cannot sync properly from !WITNESS nodes, it is strange to
continue using our valuable outbound slots on them.
* In order to prevent this change from preventing connection to
-connect= nodes which have !WITNESS, -connect nodes are now
given the "addnode" flag. This also allows outbound connections
to !NODE_NETWORK nodes for -connect nodes (which was already true
of addnodes).
* Has the (somewhat unintended) consequence of changing one of the
eviction metrics from the same
sometimes-connect-to-!WITNESS-nodes metric to requiring
HasRelevantServices.
This should make NODE_NETWORK_LIMITED much simpler to implement.
Tree-SHA512: 90606896c86cc5da14c77843b16674a6a012065e7b583d76d1c47a18215358abefcbab44ff4fab3fadcd39aa9a42d4740c6dc8874a58033bdfc8ad3fb5c649fcFile tree
6 files changed
+72
-63
lines changed- src
- rpc
6 files changed
+72
-63
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
372 | | - | |
| 372 | + | |
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
376 | | - | |
| 376 | + | |
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
| |||
815 | 815 | | |
816 | 816 | | |
817 | 817 | | |
818 | | - | |
819 | 818 | | |
820 | 819 | | |
821 | 820 | | |
| |||
1604 | 1603 | | |
1605 | 1604 | | |
1606 | 1605 | | |
1607 | | - | |
1608 | | - | |
1609 | | - | |
1610 | 1606 | | |
1611 | 1607 | | |
1612 | 1608 | | |
| |||
1663 | 1659 | | |
1664 | 1660 | | |
1665 | 1661 | | |
1666 | | - | |
1667 | 1662 | | |
1668 | 1663 | | |
1669 | 1664 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
447 | | - | |
448 | 447 | | |
449 | 448 | | |
450 | 449 | | |
| |||
685 | 684 | | |
686 | 685 | | |
687 | 686 | | |
688 | | - | |
| 687 | + | |
689 | 688 | | |
690 | 689 | | |
691 | 690 | | |
| |||
985 | 984 | | |
986 | 985 | | |
987 | 986 | | |
988 | | - | |
| 987 | + | |
989 | 988 | | |
990 | 989 | | |
991 | 990 | | |
| |||
1602 | 1601 | | |
1603 | 1602 | | |
1604 | 1603 | | |
1605 | | - | |
| 1604 | + | |
1606 | 1605 | | |
1607 | 1606 | | |
1608 | 1607 | | |
| |||
1624 | 1623 | | |
1625 | 1624 | | |
1626 | 1625 | | |
1627 | | - | |
| 1626 | + | |
1628 | 1627 | | |
1629 | 1628 | | |
1630 | 1629 | | |
| |||
1705 | 1704 | | |
1706 | 1705 | | |
1707 | 1706 | | |
1708 | | - | |
| 1707 | + | |
1709 | 1708 | | |
1710 | 1709 | | |
1711 | 1710 | | |
| |||
1753 | 1752 | | |
1754 | 1753 | | |
1755 | 1754 | | |
1756 | | - | |
1757 | 1755 | | |
1758 | 1756 | | |
1759 | 1757 | | |
1760 | 1758 | | |
1761 | | - | |
1762 | | - | |
1763 | | - | |
1764 | | - | |
1765 | | - | |
1766 | | - | |
| 1759 | + | |
1767 | 1760 | | |
1768 | 1761 | | |
1769 | 1762 | | |
| |||
1818 | 1811 | | |
1819 | 1812 | | |
1820 | 1813 | | |
1821 | | - | |
1822 | | - | |
1823 | | - | |
1824 | | - | |
1825 | 1814 | | |
1826 | 1815 | | |
1827 | 1816 | | |
1828 | 1817 | | |
1829 | | - | |
1830 | | - | |
1831 | | - | |
1832 | | - | |
1833 | | - | |
1834 | | - | |
1835 | | - | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
1836 | 1824 | | |
1837 | 1825 | | |
1838 | 1826 | | |
| |||
1841 | 1829 | | |
1842 | 1830 | | |
1843 | 1831 | | |
1844 | | - | |
1845 | | - | |
1846 | | - | |
1847 | | - | |
1848 | | - | |
1849 | | - | |
1850 | | - | |
1851 | 1832 | | |
1852 | 1833 | | |
1853 | 1834 | | |
| |||
1946 | 1927 | | |
1947 | 1928 | | |
1948 | 1929 | | |
1949 | | - | |
| 1930 | + | |
1950 | 1931 | | |
1951 | 1932 | | |
1952 | 1933 | | |
| |||
1975 | 1956 | | |
1976 | 1957 | | |
1977 | 1958 | | |
1978 | | - | |
1979 | | - | |
| 1959 | + | |
| 1960 | + | |
1980 | 1961 | | |
1981 | 1962 | | |
1982 | 1963 | | |
| |||
2712 | 2693 | | |
2713 | 2694 | | |
2714 | 2695 | | |
2715 | | - | |
2716 | 2696 | | |
2717 | 2697 | | |
2718 | 2698 | | |
| |||
2725 | 2705 | | |
2726 | 2706 | | |
2727 | 2707 | | |
2728 | | - | |
| 2708 | + | |
2729 | 2709 | | |
2730 | 2710 | | |
2731 | 2711 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | 87 | | |
90 | 88 | | |
91 | 89 | | |
| |||
130 | 128 | | |
131 | 129 | | |
132 | 130 | | |
133 | | - | |
134 | 131 | | |
135 | 132 | | |
136 | 133 | | |
| |||
152 | 149 | | |
153 | 150 | | |
154 | 151 | | |
155 | | - | |
156 | 152 | | |
157 | 153 | | |
158 | 154 | | |
| |||
175 | 171 | | |
176 | 172 | | |
177 | 173 | | |
178 | | - | |
| 174 | + | |
179 | 175 | | |
180 | 176 | | |
181 | 177 | | |
| |||
390 | 386 | | |
391 | 387 | | |
392 | 388 | | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | 389 | | |
397 | 390 | | |
398 | 391 | | |
| |||
513 | 506 | | |
514 | 507 | | |
515 | 508 | | |
516 | | - | |
| 509 | + | |
517 | 510 | | |
518 | 511 | | |
519 | 512 | | |
| |||
585 | 578 | | |
586 | 579 | | |
587 | 580 | | |
588 | | - | |
589 | 581 | | |
590 | 582 | | |
591 | 583 | | |
| |||
623 | 615 | | |
624 | 616 | | |
625 | 617 | | |
626 | | - | |
| 618 | + | |
627 | 619 | | |
628 | 620 | | |
629 | 621 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1243 | 1243 | | |
1244 | 1244 | | |
1245 | 1245 | | |
1246 | | - | |
| 1246 | + | |
1247 | 1247 | | |
1248 | | - | |
| 1248 | + | |
1249 | 1249 | | |
1250 | | - | |
| 1250 | + | |
1251 | 1251 | | |
1252 | 1252 | | |
1253 | 1253 | | |
| |||
1466 | 1466 | | |
1467 | 1467 | | |
1468 | 1468 | | |
1469 | | - | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
1470 | 1473 | | |
1471 | 1474 | | |
1472 | 1475 | | |
| |||
2642 | 2645 | | |
2643 | 2646 | | |
2644 | 2647 | | |
2645 | | - | |
2646 | | - | |
| 2648 | + | |
| 2649 | + | |
2647 | 2650 | | |
2648 | 2651 | | |
2649 | 2652 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
280 | 317 | | |
281 | 318 | | |
282 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
| 205 | + | |
204 | 206 | | |
205 | 207 | | |
206 | 208 | | |
| |||
217 | 219 | | |
218 | 220 | | |
219 | 221 | | |
220 | | - | |
| 222 | + | |
221 | 223 | | |
222 | 224 | | |
223 | 225 | | |
| |||
0 commit comments