refactor: Avoid recursive locking in CAddrMan::Check

pull/19238/head
Hennadii Stepanov 4 years ago
parent f77d9c79aa
commit 187b7d2bb3
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

@ -585,12 +585,10 @@ public:
*/
std::vector<CAddress> GetAddr(size_t max_addresses, size_t max_pct, std::optional<Network> network)
{
LOCK(cs);
Check();
std::vector<CAddress> vAddr;
{
LOCK(cs);
GetAddr_(vAddr, max_addresses, max_pct, network);
}
GetAddr_(vAddr, max_addresses, max_pct, network);
Check();
return vAddr;
}
@ -714,9 +712,10 @@ private:
//! Consistency check
void Check()
EXCLUSIVE_LOCKS_REQUIRED(cs)
{
#ifdef DEBUG_ADDRMAN
LOCK(cs);
AssertLockHeld(cs);
const int err = Check_();
if (err) {
LogPrintf("ADDRMAN CONSISTENCY CHECK FAILED!!! err=%i\n", err);

Loading…
Cancel
Save