Skip to content

Commit 021f869

Browse files
committed
[style] Run changed files through clang formatter.
1 parent 3757503 commit 021f869

File tree

4 files changed

+34
-34
lines changed

4 files changed

+34
-34
lines changed

src/addrman.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static constexpr size_t ADDRMAN_SET_TRIED_COLLISION_SIZE{10};
4141
/** The maximum time we'll spend trying to resolve a tried table collision, in seconds */
4242
static constexpr int64_t ADDRMAN_TEST_WINDOW{40*60}; // 40 minutes
4343

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
4545
{
4646
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetKey()).GetCheapHash();
4747
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
5151
return tried_bucket;
5252
}
5353

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
5555
{
5656
std::vector<unsigned char> vchSourceGroupKey = src.GetGroup(asmap);
5757
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::
6262
return new_bucket;
6363
}
6464

65-
int AddrInfo::GetBucketPosition(const uint256 &nKey, bool fNew, int nBucket) const
65+
int AddrInfo::GetBucketPosition(const uint256& nKey, bool fNew, int nBucket) const
6666
{
6767
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << (fNew ? uint8_t{'N'} : uint8_t{'K'}) << nBucket << GetKey()).GetCheapHash();
6868
return hash1 % ADDRMAN_BUCKET_SIZE;
@@ -190,7 +190,7 @@ void AddrManImpl::Serialize(Stream& s_) const
190190
int nIds = 0;
191191
for (const auto& entry : mapInfo) {
192192
mapUnkIds[entry.first] = nIds;
193-
const AddrInfo &info = entry.second;
193+
const AddrInfo& info = entry.second;
194194
if (info.nRefCount) {
195195
assert(nIds != nNew); // this means nNew was wrong, oh ow
196196
s << info;
@@ -199,7 +199,7 @@ void AddrManImpl::Serialize(Stream& s_) const
199199
}
200200
nIds = 0;
201201
for (const auto& entry : mapInfo) {
202-
const AddrInfo &info = entry.second;
202+
const AddrInfo& info = entry.second;
203203
if (info.fInTried) {
204204
assert(nIds != nTried); // this means nTried was wrong, oh ow
205205
s << info;
@@ -283,7 +283,7 @@ void AddrManImpl::Unserialize(Stream& s_)
283283

284284
// Deserialize entries from the new table.
285285
for (int n = 0; n < nNew; n++) {
286-
AddrInfo &info = mapInfo[n];
286+
AddrInfo& info = mapInfo[n];
287287
s >> info;
288288
mapAddr[info] = n;
289289
info.nRandomPos = vRandom.size();
@@ -1024,7 +1024,7 @@ size_t AddrManImpl::size() const
10241024
return vRandom.size();
10251025
}
10261026

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)
10281028
{
10291029
LOCK(cs);
10301030
int nAdd = 0;
@@ -1038,15 +1038,15 @@ bool AddrManImpl::Add(const std::vector<CAddress> &vAddr, const CNetAddr& source
10381038
return nAdd > 0;
10391039
}
10401040

1041-
void AddrManImpl::Good(const CService &addr, int64_t nTime)
1041+
void AddrManImpl::Good(const CService& addr, int64_t nTime)
10421042
{
10431043
LOCK(cs);
10441044
Check();
10451045
Good_(addr, /* test_before_evict */ true, nTime);
10461046
Check();
10471047
}
10481048

1049-
void AddrManImpl::Attempt(const CService &addr, bool fCountFailure, int64_t nTime)
1049+
void AddrManImpl::Attempt(const CService& addr, bool fCountFailure, int64_t nTime)
10501050
{
10511051
LOCK(cs);
10521052
Check();
@@ -1089,15 +1089,15 @@ std::vector<CAddress> AddrManImpl::GetAddr(size_t max_addresses, size_t max_pct,
10891089
return addresses;
10901090
}
10911091

1092-
void AddrManImpl::Connected(const CService &addr, int64_t nTime)
1092+
void AddrManImpl::Connected(const CService& addr, int64_t nTime)
10931093
{
10941094
LOCK(cs);
10951095
Check();
10961096
Connected_(addr, nTime);
10971097
Check();
10981098
}
10991099

1100-
void AddrManImpl::SetServices(const CService &addr, ServiceFlags nServices)
1100+
void AddrManImpl::SetServices(const CService& addr, ServiceFlags nServices)
11011101
{
11021102
LOCK(cs);
11031103
Check();
@@ -1141,17 +1141,17 @@ size_t AddrMan::size() const
11411141
return m_impl->size();
11421142
}
11431143

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)
11451145
{
11461146
return m_impl->Add(vAddr, source, nTimePenalty);
11471147
}
11481148

1149-
void AddrMan::Good(const CService &addr, int64_t nTime)
1149+
void AddrMan::Good(const CService& addr, int64_t nTime)
11501150
{
11511151
m_impl->Good(addr, nTime);
11521152
}
11531153

1154-
void AddrMan::Attempt(const CService &addr, bool fCountFailure, int64_t nTime)
1154+
void AddrMan::Attempt(const CService& addr, bool fCountFailure, int64_t nTime)
11551155
{
11561156
m_impl->Attempt(addr, fCountFailure, nTime);
11571157
}
@@ -1176,12 +1176,12 @@ std::vector<CAddress> AddrMan::GetAddr(size_t max_addresses, size_t max_pct, std
11761176
return m_impl->GetAddr(max_addresses, max_pct, network);
11771177
}
11781178

1179-
void AddrMan::Connected(const CService &addr, int64_t nTime)
1179+
void AddrMan::Connected(const CService& addr, int64_t nTime)
11801180
{
11811181
m_impl->Connected(addr, nTime);
11821182
}
11831183

1184-
void AddrMan::SetServices(const CService &addr, ServiceFlags nServices)
1184+
void AddrMan::SetServices(const CService& addr, ServiceFlags nServices)
11851185
{
11861186
m_impl->SetServices(addr, nServices);
11871187
}

src/addrman.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ class AddrMan
7070
size_t size() const;
7171

7272
//! Add addresses to addrman's new table.
73-
bool Add(const std::vector<CAddress> &vAddr, const CNetAddr& source, int64_t nTimePenalty = 0);
73+
bool Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t nTimePenalty = 0);
7474

7575
//! Mark an entry as accessible, possibly moving it from "new" to "tried".
76-
void Good(const CService &addr, int64_t nTime = GetAdjustedTime());
76+
void Good(const CService& addr, int64_t nTime = GetAdjustedTime());
7777

7878
//! Mark an entry as connection attempted to.
79-
void Attempt(const CService &addr, bool fCountFailure, int64_t nTime = GetAdjustedTime());
79+
void Attempt(const CService& addr, bool fCountFailure, int64_t nTime = GetAdjustedTime());
8080

8181
//! See if any to-be-evicted tried table entries have been tested and if so resolve the collisions.
8282
void ResolveCollisions();
@@ -121,10 +121,10 @@ class AddrMan
121121
* @param[in] addr The address of the peer we were connected to
122122
* @param[in] nTime The time that we were last connected to this peer
123123
*/
124-
void Connected(const CService &addr, int64_t nTime = GetAdjustedTime());
124+
void Connected(const CService& addr, int64_t nTime = GetAdjustedTime());
125125

126126
//! Update an entry's service bits.
127-
void SetServices(const CService &addr, ServiceFlags nServices);
127+
void SetServices(const CService& addr, ServiceFlags nServices);
128128

129129
const std::vector<bool>& GetAsmap() const;
130130

src/addrman_impl.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,29 +111,29 @@ class AddrManImpl
111111

112112
size_t size() const EXCLUSIVE_LOCKS_REQUIRED(!cs);
113113

114-
bool Add(const std::vector<CAddress> &vAddr, const CNetAddr& source, int64_t nTimePenalty)
114+
bool Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t nTimePenalty)
115115
EXCLUSIVE_LOCKS_REQUIRED(!cs);
116116

117-
void Good(const CService &addr, int64_t nTime)
117+
void Good(const CService& addr, int64_t nTime)
118118
EXCLUSIVE_LOCKS_REQUIRED(!cs);
119119

120-
void Attempt(const CService &addr, bool fCountFailure, int64_t nTime)
120+
void Attempt(const CService& addr, bool fCountFailure, int64_t nTime)
121121
EXCLUSIVE_LOCKS_REQUIRED(!cs);
122122

123123
void ResolveCollisions() EXCLUSIVE_LOCKS_REQUIRED(!cs);
124124

125125
std::pair<CAddress, int64_t> SelectTriedCollision() EXCLUSIVE_LOCKS_REQUIRED(!cs);
126126

127-
std::pair<CAddress, int64_t> Select(bool newOnly) const
127+
std::pair<CAddress, int64_t> Select(bool newOnly) const
128128
EXCLUSIVE_LOCKS_REQUIRED(!cs);
129129

130130
std::vector<CAddress> GetAddr(size_t max_addresses, size_t max_pct, std::optional<Network> network) const
131131
EXCLUSIVE_LOCKS_REQUIRED(!cs);
132132

133-
void Connected(const CService &addr, int64_t nTime)
133+
void Connected(const CService& addr, int64_t nTime)
134134
EXCLUSIVE_LOCKS_REQUIRED(!cs);
135135

136-
void SetServices(const CService &addr, ServiceFlags nServices)
136+
void SetServices(const CService& addr, ServiceFlags nServices)
137137
EXCLUSIVE_LOCKS_REQUIRED(!cs);
138138

139139
const std::vector<bool>& GetAsmap() const;
@@ -225,10 +225,10 @@ class AddrManImpl
225225
const std::vector<bool> m_asmap;
226226

227227
//! Find an entry.
228-
AddrInfo* Find(const CNetAddr& addr, int *pnId = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs);
228+
AddrInfo* Find(const CNetAddr& addr, int* pnId = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs);
229229

230230
//! Create a new entry and add it to the internal data structures mapInfo, mapAddr and vRandom.
231-
AddrInfo* Create(const CAddress &addr, const CNetAddr &addrSource, int *pnId = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs);
231+
AddrInfo* Create(const CAddress& addr, const CNetAddr& addrSource, int* pnId = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs);
232232

233233
//! Swap two elements in vRandom.
234234
void SwapRandom(unsigned int nRandomPos1, unsigned int nRandomPos2) const EXCLUSIVE_LOCKS_REQUIRED(cs);
@@ -242,19 +242,19 @@ class AddrManImpl
242242
//! Move an entry from the "new" table(s) to the "tried" table
243243
void MakeTried(AddrInfo& info, int nId) EXCLUSIVE_LOCKS_REQUIRED(cs);
244244

245-
void Good_(const CService &addr, bool test_before_evict, int64_t time) EXCLUSIVE_LOCKS_REQUIRED(cs);
245+
void Good_(const CService& addr, bool test_before_evict, int64_t time) EXCLUSIVE_LOCKS_REQUIRED(cs);
246246

247-
bool Add_(const CAddress &addr, const CNetAddr& source, int64_t nTimePenalty) EXCLUSIVE_LOCKS_REQUIRED(cs);
247+
bool Add_(const CAddress& addr, const CNetAddr& source, int64_t nTimePenalty) EXCLUSIVE_LOCKS_REQUIRED(cs);
248248

249-
void Attempt_(const CService &addr, bool fCountFailure, int64_t nTime) EXCLUSIVE_LOCKS_REQUIRED(cs);
249+
void Attempt_(const CService& addr, bool fCountFailure, int64_t nTime) EXCLUSIVE_LOCKS_REQUIRED(cs);
250250

251251
std::pair<CAddress, int64_t> Select_(bool newOnly) const EXCLUSIVE_LOCKS_REQUIRED(cs);
252252

253253
std::vector<CAddress> GetAddr_(size_t max_addresses, size_t max_pct, std::optional<Network> network) const EXCLUSIVE_LOCKS_REQUIRED(cs);
254254

255255
void Connected_(const CService& addr, int64_t nTime) EXCLUSIVE_LOCKS_REQUIRED(cs);
256256

257-
void SetServices_(const CService &addr, ServiceFlags nServices) EXCLUSIVE_LOCKS_REQUIRED(cs);
257+
void SetServices_(const CService& addr, ServiceFlags nServices) EXCLUSIVE_LOCKS_REQUIRED(cs);
258258

259259
void ResolveCollisions_() EXCLUSIVE_LOCKS_REQUIRED(cs);
260260

src/test/addrman_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class AddrManTest : public AddrMan
8383
bool deterministic;
8484
public:
8585
explicit AddrManTest(bool makeDeterministic = true,
86-
std::vector<bool> asmap = std::vector<bool>())
86+
std::vector<bool> asmap = std::vector<bool>())
8787
: AddrMan(asmap, makeDeterministic, /* consistency_check_ratio */ 100)
8888
{
8989
deterministic = makeDeterministic;

0 commit comments

Comments
 (0)