Conversation
The same is done in CTxMemPool::check() and other debug checks for developers, like lock order debugging.
|
Approach ACK |
There was a problem hiding this comment.
ACK cccc47b
Tested with the following changes
--- a/src/addrman.cpp
+++ b/src/addrman.cpp
@@ -463,6 +463,7 @@ void CAddrMan::Check()
{
#ifdef DEBUG_ADDRMAN
AssertLockHeld(cs);
+ LogPrint(BCLog::ADDRMAN, "Check addrman\n");
--- a/src/addrman.h
+++ b/src/addrman.h
@@ -122,6 +122,7 @@ public:
* * Several indexes are kept for high performance. Defining DEBUG_ADDRMAN will introduce frequent (and expensive)
* consistency checks for the entire data structure.
*/
+#define DEBUG_ADDRMAN
//! total number of buckets for tried addresses
#define ADDRMAN_TRIED_BUCKET_COUNT_LOG2 8| assert(setTried.count(vvTried[n][i])); | ||
| assert(mapInfo[vvTried[n][i]].GetTriedBucket(nKey, m_asmap) == n); | ||
| assert(mapInfo[vvTried[n][i]].GetBucketPosition(nKey, false, n) == i); | ||
| setTried.erase(vvTried[n][i]); |
There was a problem hiding this comment.
nit, spacing here is off by one
| //! Perform consistency check. Returns an error code or zero. | ||
| int Check_() EXCLUSIVE_LOCKS_REQUIRED(cs); | ||
| #endif | ||
| EXCLUSIVE_LOCKS_REQUIRED(cs); |
There was a problem hiding this comment.
//! Consistency check
- void Check()
- EXCLUSIVE_LOCKS_REQUIRED(cs);
+ void Check() EXCLUSIVE_LOCKS_REQUIRED(cs);Requested in bitcoin#22500 (comment)
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
theStack
left a comment
There was a problem hiding this comment.
Concept and code review ACK fa4bfef
Also built locally with #define DEBUG_ADDRMAN set in src/addrman.cpp (the CI result for this PR obviously doesn't have any value, as the modified method CAddrMan::Check() is empty after the pre-processor run)
|
re-ACK fa4bfef have been testing this rebased to current master with DEBUG_ADDRMAN defined could squash |
|
EDIT: removed them again after discussing with Marco. |
|
If If the line 518 ( |
|
Concept ACK |
|
This will make it inconvenient to do something other than For example, it might make sense to do the check right after In general |
Just writing to a log will be easily missed.
The same is done in CTxMemPool::check() and other debug checks for
developers, like lock order debugging.
Can be reviewed with https://en.wikipedia.org/wiki/De_Morgan%27s_laws and
git difftool --tool=meld cccc47b0ef~ cccc47b0ef