What changed, and why it matters
This commit simply moves a set of fixed numeric constants (such as how many buckets addresses are spread across, retry limits, and time windows) from the implementation file to the header file. It does not change any values, logic, or behavior. There is no security issue here.
No action required. This is a non-security refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch is a pure refactor: static constexpr definitions for addrman parameters are relocated from src/addrman.cpp to src/addrman.h. No values are modified, no new code paths are introduced, and no interfaces are changed. The change is cosmetic/organizational.
Changed components
src/addrman.cppsrc/addrman.hInspect captured patch +21 / −20
diff --git a/src/addrman.cpp b/src/addrman.cpp
index 2e514909..e3981e6a 100644
--- a/src/addrman.cpp
+++ b/src/addrman.cpp
@@ -24,26 +24,6 @@
#include <cmath>
#include <optional>
-/** 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 8368e30b..94e7d3e6 100644
--- a/src/addrman.h
+++ b/src/addrman.h
@@ -19,6 +19,27 @@
#include <utility>
#include <vector>
+/** 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:
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.