Skip to content

Commit 85b15dd

Browse files
[refactor] [addrman] Update constant comments
Co-authored-by: Amiti Uttarwar <[email protected]>
1 parent af9638a commit 85b15dd

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

src/addrman.cpp

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,27 @@
1515
#include <unordered_map>
1616
#include <unordered_set>
1717

18-
//! over how many buckets entries with tried addresses from a single group (/16 for IPv4) are spread
18+
/** Over how many buckets entries with tried addresses from a single group (/16 for IPv4) are spread */
1919
static constexpr uint32_t ADDRMAN_TRIED_BUCKETS_PER_GROUP{8};
20-
21-
//! over how many buckets entries with new addresses originating from a single group are spread
20+
/** Over how many buckets entries with new addresses originating from a single group are spread */
2221
static constexpr uint32_t ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP{64};
23-
24-
//! in how many buckets for entries with new addresses a single address may occur
22+
/** Maximum number of times an address can be added to the new table */
2523
static constexpr int32_t ADDRMAN_NEW_BUCKETS_PER_ADDRESS{8};
26-
27-
//! how old addresses can maximally be
24+
/** How old addresses can maximally be */
2825
static constexpr int64_t ADDRMAN_HORIZON_DAYS{30};
29-
30-
//! after how many failed attempts we give up on a new node
26+
/** After how many failed attempts we give up on a new node */
3127
static constexpr int32_t ADDRMAN_RETRIES{3};
32-
33-
//! how many successive failures are allowed ...
28+
/** How many successive failures are allowed ... */
3429
static constexpr int32_t ADDRMAN_MAX_FAILURES{10};
35-
36-
//! ... in at least this many days
30+
/** ... in at least this many days */
3731
static constexpr int64_t ADDRMAN_MIN_FAIL_DAYS{7};
38-
39-
//! how recent a successful connection should be before we allow an address to be evicted from tried
32+
/** How recent a successful connection should be before we allow an address to be evicted from tried */
4033
static constexpr int64_t ADDRMAN_REPLACEMENT_HOURS{4};
41-
42-
//! the maximum number of tried addr collisions to store
34+
/** The maximum number of tried addr collisions to store */
4335
static constexpr size_t ADDRMAN_SET_TRIED_COLLISION_SIZE{10};
44-
45-
//! the maximum time we'll spend trying to resolve a tried table collision, in seconds
36+
/** The maximum time we'll spend trying to resolve a tried table collision, in seconds */
4637
static constexpr int64_t ADDRMAN_TEST_WINDOW{40*60}; // 40 minutes
4738

48-
4939
int CAddrInfo::GetTriedBucket(const uint256& nKey, const std::vector<bool> &asmap) const
5040
{
5141
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetKey()).GetCheapHash();

src/addrman.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ class CAddrInfo : public CAddress
131131
* configuration option will introduce (expensive) consistency checks for the entire data structure.
132132
*/
133133

134-
//! total number of buckets for tried addresses
134+
/** Total number of buckets for tried addresses */
135135
static constexpr int32_t ADDRMAN_TRIED_BUCKET_COUNT_LOG2{8};
136136
static constexpr int ADDRMAN_TRIED_BUCKET_COUNT{1 << ADDRMAN_TRIED_BUCKET_COUNT_LOG2};
137137

138-
//! total number of buckets for new addresses
138+
/** Total number of buckets for new addresses */
139139
static constexpr int32_t ADDRMAN_NEW_BUCKET_COUNT_LOG2{10};
140140
static constexpr int ADDRMAN_NEW_BUCKET_COUNT{1 << ADDRMAN_NEW_BUCKET_COUNT_LOG2};
141141

142-
//! maximum allowed number of entries in buckets for new and tried addresses
142+
/** Maximum allowed number of entries in buckets for new and tried addresses */
143143
static constexpr int32_t ADDRMAN_BUCKET_SIZE_LOG2{6};
144144
static constexpr int ADDRMAN_BUCKET_SIZE{1 << ADDRMAN_BUCKET_SIZE_LOG2};
145145

0 commit comments

Comments
 (0)