Commit 803ef70
committed
Merge bitcoin/bitcoin#20233: addrman: Make consistency checks a runtime option
a4d7854 [addrman] Make addrman consistency checks a runtime option (John Newbery)
10aac24 [tests] Make deterministic addrman use nKey = 1 (John Newbery)
fa9710f [addrman] Add deterministic argument to CAddrMan ctor (John Newbery)
ee458d8 Add missing const to CAddrMan::Check_() (MarcoFalke)
Pull request description:
CAddrMan has internal consistency checks. Currently, these are only run when the program is compiled with the `DEBUG_ADDRMAN` option. This option is not enabled on any of our CI builds, and it's likely that no-one is running them at all.
This PR makes consistency checks a (hidden) runtime option that can be enabled with `-checkaddrman`, where `-checkaddrman=n` will result in the consistency checks running every n operations (similar to `-checkmempool=n`). We set the ratio to 1/100 for our unit tests, and leave it disabled by default for all networks. Additionally, a consistency check failure now asserts, rather than logging and continuing. This matches the behavior of CTxMemPool and TxRequestTracker, where a failed consistency check asserts.
ACKs for top commit:
jonatack:
ACK a4d7854 per `git diff 00fd089 a4d7854`, tested by adding logging similar to #22479 and running with `-checkaddrman=<n>` for various values 0/1/10/100 etc, tested the updated docs with `bitcoind -help-debug | grep -A2 "checkaddrman\|checkmempool"` and verified rebased on master that compiling with `CPPFLAGS="-DDEBUG_ADDRMAN"` no longer causes the build to error.
mzumsande:
Code-review ACK a4d7854
theStack:
Code-review ACK a4d7854
Tree-SHA512: eaee003f7a99154822c5b5efbc62008d32c1efbecc6fec6e183427f6b2ae5d30b3be7924e3a7271b1a1de91517f5bd2a70011d45358c3105c6a0702f12b70f7cFile tree
11 files changed
+113
-104
lines changed- src
- bench
- test
- fuzz
- util
11 files changed
+113
-104
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
434 | | - | |
435 | | - | |
| 434 | + | |
436 | 435 | | |
437 | 436 | | |
438 | 437 | | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
439 | 442 | | |
440 | 443 | | |
441 | 444 | | |
| |||
458 | 461 | | |
459 | 462 | | |
460 | 463 | | |
461 | | - | |
| 464 | + | |
| 465 | + | |
462 | 466 | | |
| 467 | + | |
463 | 468 | | |
464 | 469 | | |
465 | 470 | | |
| |||
478 | 483 | | |
479 | 484 | | |
480 | 485 | | |
481 | | - | |
| 486 | + | |
| 487 | + | |
482 | 488 | | |
483 | | - | |
| 489 | + | |
| 490 | + | |
484 | 491 | | |
| 492 | + | |
485 | 493 | | |
486 | 494 | | |
487 | 495 | | |
| |||
492 | 500 | | |
493 | 501 | | |
494 | 502 | | |
495 | | - | |
| 503 | + | |
| 504 | + | |
496 | 505 | | |
| 506 | + | |
497 | 507 | | |
498 | 508 | | |
499 | 509 | | |
| |||
509 | 519 | | |
510 | 520 | | |
511 | 521 | | |
512 | | - | |
513 | 522 | | |
514 | 523 | | |
515 | 524 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
124 | 127 | | |
125 | 128 | | |
126 | 129 | | |
127 | | - | |
128 | | - | |
| 130 | + | |
| 131 | + | |
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
| |||
493 | 496 | | |
494 | 497 | | |
495 | 498 | | |
496 | | - | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
497 | 502 | | |
498 | 503 | | |
| 504 | + | |
499 | 505 | | |
500 | 506 | | |
501 | 507 | | |
| |||
637 | 643 | | |
638 | 644 | | |
639 | 645 | | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | 646 | | |
644 | 647 | | |
645 | 648 | | |
646 | 649 | | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
647 | 653 | | |
648 | 654 | | |
649 | 655 | | |
| |||
698 | 704 | | |
699 | 705 | | |
700 | 706 | | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
701 | 710 | | |
702 | 711 | | |
703 | 712 | | |
| |||
735 | 744 | | |
736 | 745 | | |
737 | 746 | | |
738 | | - | |
739 | | - | |
| 747 | + | |
740 | 748 | | |
741 | | - | |
742 | 749 | | |
| 750 | + | |
743 | 751 | | |
744 | 752 | | |
745 | 753 | | |
| 754 | + | |
746 | 755 | | |
747 | | - | |
748 | 756 | | |
749 | 757 | | |
750 | | - | |
751 | 758 | | |
752 | 759 | | |
753 | | - | |
754 | 760 | | |
755 | 761 | | |
756 | 762 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
115 | 116 | | |
116 | | - | |
117 | | - | |
118 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
| |||
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
133 | | - | |
| 135 | + | |
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
504 | | - | |
| 504 | + | |
| 505 | + | |
505 | 506 | | |
506 | 507 | | |
507 | 508 | | |
| |||
1164 | 1165 | | |
1165 | 1166 | | |
1166 | 1167 | | |
1167 | | - | |
| 1168 | + | |
| 1169 | + | |
1168 | 1170 | | |
1169 | 1171 | | |
1170 | 1172 | | |
| |||
0 commit comments