@@ -132,48 +132,48 @@ class CAddrInfo : public CAddress
132
132
*/
133
133
134
134
// ! total number of buckets for tried addresses
135
- # define ADDRMAN_TRIED_BUCKET_COUNT_LOG2 8
135
+ static constexpr int32_t ADDRMAN_TRIED_BUCKET_COUNT_LOG2{ 8 };
136
136
137
137
// ! total number of buckets for new addresses
138
- # define ADDRMAN_NEW_BUCKET_COUNT_LOG2 10
138
+ static constexpr int32_t ADDRMAN_NEW_BUCKET_COUNT_LOG2{ 10 };
139
139
140
140
// ! maximum allowed number of entries in buckets for new and tried addresses
141
- # define ADDRMAN_BUCKET_SIZE_LOG2 6
141
+ static constexpr int32_t ADDRMAN_BUCKET_SIZE_LOG2{ 6 };
142
142
143
143
// ! over how many buckets entries with tried addresses from a single group (/16 for IPv4) are spread
144
- # define ADDRMAN_TRIED_BUCKETS_PER_GROUP 8
144
+ static constexpr uint32_t ADDRMAN_TRIED_BUCKETS_PER_GROUP{ 8 };
145
145
146
146
// ! over how many buckets entries with new addresses originating from a single group are spread
147
- # define ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP 64
147
+ static constexpr uint32_t ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP{ 64 };
148
148
149
149
// ! in how many buckets for entries with new addresses a single address may occur
150
- # define ADDRMAN_NEW_BUCKETS_PER_ADDRESS 8
150
+ static constexpr int32_t ADDRMAN_NEW_BUCKETS_PER_ADDRESS{ 8 };
151
151
152
152
// ! how old addresses can maximally be
153
- # define ADDRMAN_HORIZON_DAYS 30
153
+ static constexpr int64_t ADDRMAN_HORIZON_DAYS{ 30 };
154
154
155
155
// ! after how many failed attempts we give up on a new node
156
- # define ADDRMAN_RETRIES 3
156
+ static constexpr int32_t ADDRMAN_RETRIES{ 3 };
157
157
158
158
// ! how many successive failures are allowed ...
159
- # define ADDRMAN_MAX_FAILURES 10
159
+ static constexpr int32_t ADDRMAN_MAX_FAILURES{ 10 };
160
160
161
161
// ! ... in at least this many days
162
- # define ADDRMAN_MIN_FAIL_DAYS 7
162
+ static constexpr int64_t ADDRMAN_MIN_FAIL_DAYS{ 7 };
163
163
164
164
// ! how recent a successful connection should be before we allow an address to be evicted from tried
165
- # define ADDRMAN_REPLACEMENT_HOURS 4
165
+ static constexpr int64_t ADDRMAN_REPLACEMENT_HOURS{ 4 };
166
166
167
167
// ! Convenience
168
- # define ADDRMAN_TRIED_BUCKET_COUNT ( 1 << ADDRMAN_TRIED_BUCKET_COUNT_LOG2)
169
- # define ADDRMAN_NEW_BUCKET_COUNT ( 1 << ADDRMAN_NEW_BUCKET_COUNT_LOG2)
170
- # define ADDRMAN_BUCKET_SIZE ( 1 << ADDRMAN_BUCKET_SIZE_LOG2)
168
+ static constexpr int ADDRMAN_TRIED_BUCKET_COUNT{ 1 << ADDRMAN_TRIED_BUCKET_COUNT_LOG2};
169
+ static constexpr int ADDRMAN_NEW_BUCKET_COUNT{ 1 << ADDRMAN_NEW_BUCKET_COUNT_LOG2};
170
+ static constexpr int ADDRMAN_BUCKET_SIZE{ 1 << ADDRMAN_BUCKET_SIZE_LOG2};
171
171
172
172
// ! the maximum number of tried addr collisions to store
173
- # define ADDRMAN_SET_TRIED_COLLISION_SIZE 10
173
+ static constexpr size_t ADDRMAN_SET_TRIED_COLLISION_SIZE{ 10 };
174
174
175
175
// ! the maximum time we'll spend trying to resolve a tried table collision, in seconds
176
- static const int64_t ADDRMAN_TEST_WINDOW = 40 *60 ; // 40 minutes
176
+ static constexpr int64_t ADDRMAN_TEST_WINDOW{ 40 *60 } ; // 40 minutes
177
177
178
178
/* *
179
179
* Stochastical (IP) address manager
0 commit comments