Skip to content

Commit adf9bcf

Browse files
committed
Merge bitcoin/bitcoin#22696: p2p: log addrman consistency checks
4844b74 p2p: log addrman consistency checks (Jon Atack) Pull request description: This mini-patch picks up #22479 to log addrman consistency checks in the `BCLOG::ADDRMAN` category when they are enabled with the `-checkaddrman=<n>` configuration option for values of n greater than 0. ``` $ ./src/bitcoind -signet -checkaddrman=20 -debug=addrman ... 2021-08-13T11:14:45Z Addrman checks started: new 3352, tried 89, total 3441 2021-08-13T11:14:45Z Addrman checks completed successfully ``` This allows people to - verify the checks are running - see when and how often they are being performed - see the number of new/tried/total addrman entries per check - see the start/end of the checks Thanks to John Newbery for ideas to improve this logging. ACKs for top commit: jnewbery: Code review ACK 4844b74 Zero-1729: tACK 4844b74 theStack: Concept and code-review ACK 4844b74 ♟️ Tree-SHA512: 10b51c480d52a753ea8a59dbdd1e2c4f49067e7f4afe59d58426a8fb438f52447fe3a6090fa52132bc382d876927fa338b229c906d85668086f7f8f5bd8ed38a
2 parents 4c87665 + 4844b74 commit adf9bcf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/addrman.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,8 @@ int CAddrMan::Check_() const
439439
if (m_consistency_check_ratio == 0) return 0;
440440
if (insecure_rand.randrange(m_consistency_check_ratio) >= 1) return 0;
441441

442+
LogPrint(BCLog::ADDRMAN, "Addrman checks started: new %i, tried %i, total %u\n", nNew, nTried, vRandom.size());
443+
442444
std::unordered_set<int> setTried;
443445
std::unordered_map<int, int> mapNew;
444446

@@ -517,6 +519,7 @@ int CAddrMan::Check_() const
517519
if (nKey.IsNull())
518520
return -16;
519521

522+
LogPrint(BCLog::ADDRMAN, "Addrman checks completed successfully\n");
520523
return 0;
521524
}
522525

0 commit comments

Comments
 (0)