Skip to content

Commit a903ad7

Browse files
committed
Merge pull request #6283
26a639e remove using namespace std from addrman.cpp (Philip Kaufmann) 40c592a make CAddrMan::size() return the correct type of size_t (Philip Kaufmann)
2 parents 7fe29d8 + 26a639e commit a903ad7

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/addrman.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#include "serialize.h"
99
#include "streams.h"
1010

11-
using namespace std;
12-
1311
int CAddrInfo::GetTriedBucket(const uint256& nKey) const
1412
{
1513
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetKey()).GetHash().GetCheapHash();
@@ -68,7 +66,7 @@ double CAddrInfo::GetChance(int64_t nNow) const
6866
fChance *= 0.01;
6967

7068
// deprioritize 66% after each failed attempt, but at most 1/28th to avoid the search taking forever or overly penalizing outages.
71-
fChance *= pow(0.66, min(nAttempts, 8));
69+
fChance *= pow(0.66, std::min(nAttempts, 8));
7270

7371
return fChance;
7472
}
@@ -258,7 +256,7 @@ bool CAddrMan::Add_(const CAddress& addr, const CNetAddr& source, int64_t nTimeP
258256
bool fCurrentlyOnline = (GetAdjustedTime() - addr.nTime < 24 * 60 * 60);
259257
int64_t nUpdateInterval = (fCurrentlyOnline ? 60 * 60 : 24 * 60 * 60);
260258
if (addr.nTime && (!pinfo->nTime || pinfo->nTime < addr.nTime - nUpdateInterval - nTimePenalty))
261-
pinfo->nTime = max((int64_t)0, addr.nTime - nTimePenalty);
259+
pinfo->nTime = std::max((int64_t)0, addr.nTime - nTimePenalty);
262260

263261
// add services
264262
pinfo->nServices |= addr.nServices;
@@ -283,7 +281,7 @@ bool CAddrMan::Add_(const CAddress& addr, const CNetAddr& source, int64_t nTimeP
283281
return false;
284282
} else {
285283
pinfo = Create(addr, source, &nId);
286-
pinfo->nTime = max((int64_t)0, (int64_t)pinfo->nTime - nTimePenalty);
284+
pinfo->nTime = std::max((int64_t)0, (int64_t)pinfo->nTime - nTimePenalty);
287285
nNew++;
288286
fNew = true;
289287
}

src/addrman.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ class CAddrMan
458458
}
459459

460460
//! Return the number of (unique) addresses in all tables.
461-
int size()
461+
size_t size() const
462462
{
463463
return vRandom.size();
464464
}

0 commit comments

Comments
 (0)