@@ -41,7 +41,7 @@ static constexpr size_t ADDRMAN_SET_TRIED_COLLISION_SIZE{10};
41
41
/* * The maximum time we'll spend trying to resolve a tried table collision, in seconds */
42
42
static constexpr int64_t ADDRMAN_TEST_WINDOW{40 *60 }; // 40 minutes
43
43
44
- int AddrInfo::GetTriedBucket (const uint256& nKey, const std::vector<bool > & asmap) const
44
+ int AddrInfo::GetTriedBucket (const uint256& nKey, const std::vector<bool >& asmap) const
45
45
{
46
46
uint64_t hash1 = (CHashWriter (SER_GETHASH, 0 ) << nKey << GetKey ()).GetCheapHash ();
47
47
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
51
51
return tried_bucket;
52
52
}
53
53
54
- int AddrInfo::GetNewBucket (const uint256& nKey, const CNetAddr& src, const std::vector<bool > & asmap) const
54
+ int AddrInfo::GetNewBucket (const uint256& nKey, const CNetAddr& src, const std::vector<bool >& asmap) const
55
55
{
56
56
std::vector<unsigned char > vchSourceGroupKey = src.GetGroup (asmap);
57
57
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::
62
62
return new_bucket;
63
63
}
64
64
65
- int AddrInfo::GetBucketPosition (const uint256 & nKey, bool fNew , int nBucket) const
65
+ int AddrInfo::GetBucketPosition (const uint256& nKey, bool fNew , int nBucket) const
66
66
{
67
67
uint64_t hash1 = (CHashWriter (SER_GETHASH, 0 ) << nKey << (fNew ? uint8_t {' N' } : uint8_t {' K' }) << nBucket << GetKey ()).GetCheapHash ();
68
68
return hash1 % ADDRMAN_BUCKET_SIZE;
@@ -190,7 +190,7 @@ void AddrManImpl::Serialize(Stream& s_) const
190
190
int nIds = 0 ;
191
191
for (const auto & entry : mapInfo) {
192
192
mapUnkIds[entry.first ] = nIds;
193
- const AddrInfo & info = entry.second ;
193
+ const AddrInfo& info = entry.second ;
194
194
if (info.nRefCount ) {
195
195
assert (nIds != nNew); // this means nNew was wrong, oh ow
196
196
s << info;
@@ -199,7 +199,7 @@ void AddrManImpl::Serialize(Stream& s_) const
199
199
}
200
200
nIds = 0 ;
201
201
for (const auto & entry : mapInfo) {
202
- const AddrInfo & info = entry.second ;
202
+ const AddrInfo& info = entry.second ;
203
203
if (info.fInTried ) {
204
204
assert (nIds != nTried); // this means nTried was wrong, oh ow
205
205
s << info;
@@ -283,7 +283,7 @@ void AddrManImpl::Unserialize(Stream& s_)
283
283
284
284
// Deserialize entries from the new table.
285
285
for (int n = 0 ; n < nNew; n++) {
286
- AddrInfo & info = mapInfo[n];
286
+ AddrInfo& info = mapInfo[n];
287
287
s >> info;
288
288
mapAddr[info] = n;
289
289
info.nRandomPos = vRandom.size ();
@@ -1024,7 +1024,7 @@ size_t AddrManImpl::size() const
1024
1024
return vRandom.size ();
1025
1025
}
1026
1026
1027
- bool AddrManImpl::Add (const std::vector<CAddress> & vAddr, const CNetAddr& source, int64_t nTimePenalty)
1027
+ bool AddrManImpl::Add (const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t nTimePenalty)
1028
1028
{
1029
1029
LOCK (cs);
1030
1030
int nAdd = 0 ;
@@ -1038,15 +1038,15 @@ bool AddrManImpl::Add(const std::vector<CAddress> &vAddr, const CNetAddr& source
1038
1038
return nAdd > 0 ;
1039
1039
}
1040
1040
1041
- void AddrManImpl::Good (const CService & addr, int64_t nTime)
1041
+ void AddrManImpl::Good (const CService& addr, int64_t nTime)
1042
1042
{
1043
1043
LOCK (cs);
1044
1044
Check ();
1045
1045
Good_ (addr, /* test_before_evict */ true , nTime);
1046
1046
Check ();
1047
1047
}
1048
1048
1049
- void AddrManImpl::Attempt (const CService & addr, bool fCountFailure , int64_t nTime)
1049
+ void AddrManImpl::Attempt (const CService& addr, bool fCountFailure , int64_t nTime)
1050
1050
{
1051
1051
LOCK (cs);
1052
1052
Check ();
@@ -1089,15 +1089,15 @@ std::vector<CAddress> AddrManImpl::GetAddr(size_t max_addresses, size_t max_pct,
1089
1089
return addresses;
1090
1090
}
1091
1091
1092
- void AddrManImpl::Connected (const CService & addr, int64_t nTime)
1092
+ void AddrManImpl::Connected (const CService& addr, int64_t nTime)
1093
1093
{
1094
1094
LOCK (cs);
1095
1095
Check ();
1096
1096
Connected_ (addr, nTime);
1097
1097
Check ();
1098
1098
}
1099
1099
1100
- void AddrManImpl::SetServices (const CService & addr, ServiceFlags nServices)
1100
+ void AddrManImpl::SetServices (const CService& addr, ServiceFlags nServices)
1101
1101
{
1102
1102
LOCK (cs);
1103
1103
Check ();
@@ -1141,17 +1141,17 @@ size_t AddrMan::size() const
1141
1141
return m_impl->size ();
1142
1142
}
1143
1143
1144
- bool AddrMan::Add (const std::vector<CAddress> & vAddr, const CNetAddr& source, int64_t nTimePenalty)
1144
+ bool AddrMan::Add (const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t nTimePenalty)
1145
1145
{
1146
1146
return m_impl->Add (vAddr, source, nTimePenalty);
1147
1147
}
1148
1148
1149
- void AddrMan::Good (const CService & addr, int64_t nTime)
1149
+ void AddrMan::Good (const CService& addr, int64_t nTime)
1150
1150
{
1151
1151
m_impl->Good (addr, nTime);
1152
1152
}
1153
1153
1154
- void AddrMan::Attempt (const CService & addr, bool fCountFailure , int64_t nTime)
1154
+ void AddrMan::Attempt (const CService& addr, bool fCountFailure , int64_t nTime)
1155
1155
{
1156
1156
m_impl->Attempt (addr, fCountFailure , nTime);
1157
1157
}
@@ -1176,12 +1176,12 @@ std::vector<CAddress> AddrMan::GetAddr(size_t max_addresses, size_t max_pct, std
1176
1176
return m_impl->GetAddr (max_addresses, max_pct, network);
1177
1177
}
1178
1178
1179
- void AddrMan::Connected (const CService & addr, int64_t nTime)
1179
+ void AddrMan::Connected (const CService& addr, int64_t nTime)
1180
1180
{
1181
1181
m_impl->Connected (addr, nTime);
1182
1182
}
1183
1183
1184
- void AddrMan::SetServices (const CService & addr, ServiceFlags nServices)
1184
+ void AddrMan::SetServices (const CService& addr, ServiceFlags nServices)
1185
1185
{
1186
1186
m_impl->SetServices (addr, nServices);
1187
1187
}
0 commit comments