aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.h
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2021-08-05 14:14:21 +0100
committerJohn Newbery <john@johnnewbery.com>2021-08-19 11:29:54 +0100
commit4d2fa97031a6f31da984d4c2c105447ed692c6ed (patch)
treef4046506c89395ea7310f5910d0edd954b8ab9e9 /src/addrman.h
parent7e6e65918f75211b517fc887f5d90df8edd52ced (diff)
downloadbitcoin-4d2fa97031a6f31da984d4c2c105447ed692c6ed.tar.xz
[addrman] Clean up ctor
Use default initialization and initializer lists, and use range-based for loops for resetting the buckets.
Diffstat (limited to 'src/addrman.h')
-rw-r--r--src/addrman.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/addrman.h b/src/addrman.h
index 3d49c2583f..e2cb60b061 100644
--- a/src/addrman.h
+++ b/src/addrman.h
@@ -626,7 +626,7 @@ private:
static constexpr uint8_t INCOMPATIBILITY_BASE = 32;
//! last used nId
- int nIdCount GUARDED_BY(cs);
+ int nIdCount GUARDED_BY(cs){0};
//! table with information about all nIds
std::unordered_map<int, CAddrInfo> mapInfo GUARDED_BY(cs);
@@ -640,19 +640,19 @@ private:
mutable std::vector<int> vRandom GUARDED_BY(cs);
// number of "tried" entries
- int nTried GUARDED_BY(cs);
+ int nTried GUARDED_BY(cs){0};
//! list of "tried" buckets
int vvTried[ADDRMAN_TRIED_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE] GUARDED_BY(cs);
//! number of (unique) "new" entries
- int nNew GUARDED_BY(cs);
+ int nNew GUARDED_BY(cs){0};
//! list of "new" buckets
int vvNew[ADDRMAN_NEW_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE] GUARDED_BY(cs);
- //! last time Good was called (memory only)
- int64_t nLastGood GUARDED_BY(cs);
+ //! last time Good was called (memory only). Initially set to 1 so that "never" is strictly worse.
+ int64_t nLastGood GUARDED_BY(cs){1};
//! Holds addrs inserted into tried table that collide with existing entries. Test-before-evict discipline used to resolve these collisions.
std::set<int> m_tried_collisions;