mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-02 19:19:41 +01:00
Refactor: Turn the internal addrman check helper into a forced check
This commit is contained in:
@@ -747,21 +747,21 @@ void CAddrMan::Check() const
|
||||
{
|
||||
AssertLockHeld(cs);
|
||||
|
||||
const int err = Check_();
|
||||
// Run consistency checks 1 in m_consistency_check_ratio times if enabled
|
||||
if (m_consistency_check_ratio == 0) return;
|
||||
if (insecure_rand.randrange(m_consistency_check_ratio) >= 1) return;
|
||||
|
||||
const int err{ForceCheckAddrman()};
|
||||
if (err) {
|
||||
LogPrintf("ADDRMAN CONSISTENCY CHECK FAILED!!! err=%i\n", err);
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
int CAddrMan::Check_() const
|
||||
int CAddrMan::ForceCheckAddrman() const
|
||||
{
|
||||
AssertLockHeld(cs);
|
||||
|
||||
// Run consistency checks 1 in m_consistency_check_ratio times if enabled
|
||||
if (m_consistency_check_ratio == 0) return 0;
|
||||
if (insecure_rand.randrange(m_consistency_check_ratio) >= 1) return 0;
|
||||
|
||||
LogPrint(BCLog::ADDRMAN, "Addrman checks started: new %i, tried %i, total %u\n", nNew, nTried, vRandom.size());
|
||||
|
||||
std::unordered_set<int> setTried;
|
||||
|
||||
Reference in New Issue
Block a user