From f611d3bdaf035280f44d5183a8322c0a0c6e3d27 Mon Sep 17 00:00:00 2001 From: brunoerg Date: Mon, 16 Feb 2026 16:05:23 -0300 Subject: [PATCH] refactor: addrman: move consts to .h --- src/addrman.cpp | 20 -------------------- src/addrman.h | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/addrman.cpp b/src/addrman.cpp index 2e5149093c4..e3981e6a404 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -24,26 +24,6 @@ #include #include -/** Over how many buckets entries with tried addresses from a single group (/16 for IPv4) are spread */ -static constexpr uint32_t ADDRMAN_TRIED_BUCKETS_PER_GROUP{8}; -/** Over how many buckets entries with new addresses originating from a single group are spread */ -static constexpr uint32_t ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP{64}; -/** Maximum number of times an address can occur in the new table */ -static constexpr int32_t ADDRMAN_NEW_BUCKETS_PER_ADDRESS{8}; -/** How old addresses can maximally be */ -static constexpr auto ADDRMAN_HORIZON{30 * 24h}; -/** After how many failed attempts we give up on a new node */ -static constexpr int32_t ADDRMAN_RETRIES{3}; -/** How many successive failures are allowed ... */ -static constexpr int32_t ADDRMAN_MAX_FAILURES{10}; -/** ... in at least this duration */ -static constexpr auto ADDRMAN_MIN_FAIL{7 * 24h}; -/** How recent a successful connection should be before we allow an address to be evicted from tried */ -static constexpr auto ADDRMAN_REPLACEMENT{4h}; -/** The maximum number of tried addr collisions to store */ -static constexpr size_t ADDRMAN_SET_TRIED_COLLISION_SIZE{10}; -/** The maximum time we'll spend trying to resolve a tried table collision */ -static constexpr auto ADDRMAN_TEST_WINDOW{40min}; int AddrInfo::GetTriedBucket(const uint256& nKey, const NetGroupManager& netgroupman) const { diff --git a/src/addrman.h b/src/addrman.h index 8368e30b7b7..94e7d3e6537 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -19,6 +19,27 @@ #include #include +/** Over how many buckets entries with tried addresses from a single group (/16 for IPv4) are spread */ +static constexpr uint32_t ADDRMAN_TRIED_BUCKETS_PER_GROUP{8}; +/** Over how many buckets entries with new addresses originating from a single group are spread */ +static constexpr uint32_t ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP{64}; +/** Maximum number of times an address can occur in the new table */ +static constexpr int32_t ADDRMAN_NEW_BUCKETS_PER_ADDRESS{8}; +/** How old addresses can maximally be */ +static constexpr auto ADDRMAN_HORIZON{30 * 24h}; +/** After how many failed attempts we give up on a new node */ +static constexpr int32_t ADDRMAN_RETRIES{3}; +/** How many successive failures are allowed ... */ +static constexpr int32_t ADDRMAN_MAX_FAILURES{10}; +/** ... in at least this duration */ +static constexpr auto ADDRMAN_MIN_FAIL{7 * 24h}; +/** How recent a successful connection should be before we allow an address to be evicted from tried */ +static constexpr auto ADDRMAN_REPLACEMENT{4h}; +/** The maximum number of tried addr collisions to store */ +static constexpr size_t ADDRMAN_SET_TRIED_COLLISION_SIZE{10}; +/** The maximum time we'll spend trying to resolve a tried table collision */ +static constexpr auto ADDRMAN_TEST_WINDOW{40min}; + class InvalidAddrManVersionError : public std::ios_base::failure { public: