[addrman] Merge the two Add() functions

Merge the two definitions of this overloaded function to reduce code
duplication.
This commit is contained in:
Amiti Uttarwar
2021-07-22 17:00:36 -07:00
parent 3facf0a8ae
commit 60e0cbdd57
5 changed files with 42 additions and 68 deletions

View File

@@ -517,22 +517,7 @@ public:
return vRandom.size();
}
//! Add a single address.
bool Add(const CAddress &addr, const CNetAddr& source, int64_t nTimePenalty = 0)
EXCLUSIVE_LOCKS_REQUIRED(!cs)
{
LOCK(cs);
bool fRet = false;
Check();
fRet |= Add_(addr, source, nTimePenalty);
Check();
if (fRet) {
LogPrint(BCLog::ADDRMAN, "Added %s from %s: %i tried, %i new\n", addr.ToStringIPPort(), source.ToString(), nTried, nNew);
}
return fRet;
}
//! Add multiple addresses.
//! Add addresses to addrman's new table.
bool Add(const std::vector<CAddress> &vAddr, const CNetAddr& source, int64_t nTimePenalty = 0)
EXCLUSIVE_LOCKS_REQUIRED(!cs)
{