aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.cpp
diff options
context:
space:
mode:
authorAmiti Uttarwar <amiti@uttarwar.org>2021-09-10 18:53:57 -0600
committerAmiti Uttarwar <amiti@uttarwar.org>2021-09-28 22:21:10 -0400
commit021f86953e8a1dff8ecc768186368d345c865cc2 (patch)
tree577d340c9606340fe140b9e734c41ed1450d74f8 /src/addrman.cpp
parent375750387e35ed751d1f5ab48860bdec93977f64 (diff)
[style] Run changed files through clang formatter.
Diffstat (limited to 'src/addrman.cpp')
-rw-r--r--src/addrman.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/addrman.cpp b/src/addrman.cpp
index c015026cbc..c364a7710b 100644
--- a/src/addrman.cpp
+++ b/src/addrman.cpp
@@ -41,7 +41,7 @@ static constexpr size_t ADDRMAN_SET_TRIED_COLLISION_SIZE{10};
/** The maximum time we'll spend trying to resolve a tried table collision, in seconds */
static constexpr int64_t ADDRMAN_TEST_WINDOW{40*60}; // 40 minutes
-int AddrInfo::GetTriedBucket(const uint256& nKey, const std::vector<bool> &asmap) const
+int AddrInfo::GetTriedBucket(const uint256& nKey, const std::vector<bool>& asmap) const
{
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetKey()).GetCheapHash();
uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << GetGroup(asmap) << (hash1 % ADDRMAN_TRIED_BUCKETS_PER_GROUP)).GetCheapHash();
@@ -51,7 +51,7 @@ int AddrInfo::GetTriedBucket(const uint256& nKey, const std::vector<bool> &asmap
return tried_bucket;
}
-int AddrInfo::GetNewBucket(const uint256& nKey, const CNetAddr& src, const std::vector<bool> &asmap) const
+int AddrInfo::GetNewBucket(const uint256& nKey, const CNetAddr& src, const std::vector<bool>& asmap) const
{
std::vector<unsigned char> vchSourceGroupKey = src.GetGroup(asmap);
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetGroup(asmap) << vchSourceGroupKey).GetCheapHash();
@@ -62,7 +62,7 @@ int AddrInfo::GetNewBucket(const uint256& nKey, const CNetAddr& src, const std::
return new_bucket;
}
-int AddrInfo::GetBucketPosition(const uint256 &nKey, bool fNew, int nBucket) const
+int AddrInfo::GetBucketPosition(const uint256& nKey, bool fNew, int nBucket) const
{
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << (fNew ? uint8_t{'N'} : uint8_t{'K'}) << nBucket << GetKey()).GetCheapHash();
return hash1 % ADDRMAN_BUCKET_SIZE;
@@ -190,7 +190,7 @@ void AddrManImpl::Serialize(Stream& s_) const
int nIds = 0;
for (const auto& entry : mapInfo) {
mapUnkIds[entry.first] = nIds;
- const AddrInfo &info = entry.second;
+ const AddrInfo& info = entry.second;
if (info.nRefCount) {
assert(nIds != nNew); // this means nNew was wrong, oh ow
s << info;
@@ -199,7 +199,7 @@ void AddrManImpl::Serialize(Stream& s_) const
}
nIds = 0;
for (const auto& entry : mapInfo) {
- const AddrInfo &info = entry.second;
+ const AddrInfo& info = entry.second;
if (info.fInTried) {
assert(nIds != nTried); // this means nTried was wrong, oh ow
s << info;
@@ -283,7 +283,7 @@ void AddrManImpl::Unserialize(Stream& s_)
// Deserialize entries from the new table.
for (int n = 0; n < nNew; n++) {
- AddrInfo &info = mapInfo[n];
+ AddrInfo& info = mapInfo[n];
s >> info;
mapAddr[info] = n;
info.nRandomPos = vRandom.size();
@@ -1024,7 +1024,7 @@ size_t AddrManImpl::size() const
return vRandom.size();
}
-bool AddrManImpl::Add(const std::vector<CAddress> &vAddr, const CNetAddr& source, int64_t nTimePenalty)
+bool AddrManImpl::Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t nTimePenalty)
{
LOCK(cs);
int nAdd = 0;
@@ -1038,7 +1038,7 @@ bool AddrManImpl::Add(const std::vector<CAddress> &vAddr, const CNetAddr& source
return nAdd > 0;
}
-void AddrManImpl::Good(const CService &addr, int64_t nTime)
+void AddrManImpl::Good(const CService& addr, int64_t nTime)
{
LOCK(cs);
Check();
@@ -1046,7 +1046,7 @@ void AddrManImpl::Good(const CService &addr, int64_t nTime)
Check();
}
-void AddrManImpl::Attempt(const CService &addr, bool fCountFailure, int64_t nTime)
+void AddrManImpl::Attempt(const CService& addr, bool fCountFailure, int64_t nTime)
{
LOCK(cs);
Check();
@@ -1089,7 +1089,7 @@ std::vector<CAddress> AddrManImpl::GetAddr(size_t max_addresses, size_t max_pct,
return addresses;
}
-void AddrManImpl::Connected(const CService &addr, int64_t nTime)
+void AddrManImpl::Connected(const CService& addr, int64_t nTime)
{
LOCK(cs);
Check();
@@ -1097,7 +1097,7 @@ void AddrManImpl::Connected(const CService &addr, int64_t nTime)
Check();
}
-void AddrManImpl::SetServices(const CService &addr, ServiceFlags nServices)
+void AddrManImpl::SetServices(const CService& addr, ServiceFlags nServices)
{
LOCK(cs);
Check();
@@ -1141,17 +1141,17 @@ size_t AddrMan::size() const
return m_impl->size();
}
-bool AddrMan::Add(const std::vector<CAddress> &vAddr, const CNetAddr& source, int64_t nTimePenalty)
+bool AddrMan::Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t nTimePenalty)
{
return m_impl->Add(vAddr, source, nTimePenalty);
}
-void AddrMan::Good(const CService &addr, int64_t nTime)
+void AddrMan::Good(const CService& addr, int64_t nTime)
{
m_impl->Good(addr, nTime);
}
-void AddrMan::Attempt(const CService &addr, bool fCountFailure, int64_t nTime)
+void AddrMan::Attempt(const CService& addr, bool fCountFailure, int64_t nTime)
{
m_impl->Attempt(addr, fCountFailure, nTime);
}
@@ -1176,12 +1176,12 @@ std::vector<CAddress> AddrMan::GetAddr(size_t max_addresses, size_t max_pct, std
return m_impl->GetAddr(max_addresses, max_pct, network);
}
-void AddrMan::Connected(const CService &addr, int64_t nTime)
+void AddrMan::Connected(const CService& addr, int64_t nTime)
{
m_impl->Connected(addr, nTime);
}
-void AddrMan::SetServices(const CService &addr, ServiceFlags nServices)
+void AddrMan::SetServices(const CService& addr, ServiceFlags nServices)
{
m_impl->SetServices(addr, nServices);
}