aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/addrman.cpp')
-rw-r--r--src/addrman.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/addrman.cpp b/src/addrman.cpp
index c364a7710b..c040b0ae5c 100644
--- a/src/addrman.cpp
+++ b/src/addrman.cpp
@@ -7,6 +7,8 @@
#include <addrman_impl.h>
#include <hash.h>
+#include <logging.h>
+#include <logging/timer.h>
#include <netaddress.h>
#include <protocol.h>
#include <random.h>
@@ -393,7 +395,7 @@ void AddrManImpl::Unserialize(Stream& s_)
LogPrint(BCLog::ADDRMAN, "addrman lost %i new and %i tried addresses due to collisions or invalid addresses\n", nLostUnk, nLost);
}
- const int check_code{ForceCheckAddrman()};
+ const int check_code{CheckAddrman()};
if (check_code != 0) {
throw std::ios_base::failure(strprintf(
"Corrupt data. Consistency check failed with code %s",
@@ -923,18 +925,19 @@ void AddrManImpl::Check() const
if (m_consistency_check_ratio == 0) return;
if (insecure_rand.randrange(m_consistency_check_ratio) >= 1) return;
- const int err{ForceCheckAddrman()};
+ const int err{CheckAddrman()};
if (err) {
LogPrintf("ADDRMAN CONSISTENCY CHECK FAILED!!! err=%i\n", err);
assert(false);
}
}
-int AddrManImpl::ForceCheckAddrman() const
+int AddrManImpl::CheckAddrman() const
{
AssertLockHeld(cs);
- LogPrint(BCLog::ADDRMAN, "Addrman checks started: new %i, tried %i, total %u\n", nNew, nTried, vRandom.size());
+ LOG_TIME_MILLIS_WITH_CATEGORY_MSG_ONCE(
+ strprintf("new %i, tried %i, total %u", nNew, nTried, vRandom.size()), BCLog::ADDRMAN);
std::unordered_set<int> setTried;
std::unordered_map<int, int> mapNew;
@@ -1014,7 +1017,6 @@ int AddrManImpl::ForceCheckAddrman() const
if (nKey.IsNull())
return -16;
- LogPrint(BCLog::ADDRMAN, "Addrman checks completed successfully\n");
return 0;
}