Skip to content

Commit 7cc0e81

Browse files
committed
Remove useless 2500 limit on AddrMan queries
1 parent ded742b commit 7cc0e81

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/addrman.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class CAddrInfo : public CAddress
157157
#define ADDRMAN_GETADDR_MAX_PCT 23
158158

159159
//! the maximum number of nodes to return in a getaddr call
160-
#define ADDRMAN_GETADDR_MAX 2500
160+
#define ADDRMAN_GETADDR_MAX 1000
161161

162162
//! Convenience
163163
#define ADDRMAN_TRIED_BUCKET_COUNT (1 << ADDRMAN_TRIED_BUCKET_COUNT_LOG2)

src/net.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ static const int TIMEOUT_INTERVAL = 20 * 60;
5252
static const int FEELER_INTERVAL = 120;
5353
/** The maximum number of new addresses to accumulate before announcing. */
5454
static const unsigned int MAX_ADDR_TO_SEND = 1000;
55+
// TODO: remove ADDRMAN_GETADDR_MAX and let the caller specify this limit with MAX_ADDR_TO_SEND.
56+
static_assert(MAX_ADDR_TO_SEND == ADDRMAN_GETADDR_MAX,
57+
"Max allowed ADDR message size should be equal to the max number of records returned from AddrMan.");
5558
/** Maximum length of incoming protocol messages (no message over 4 MB is currently acceptable). */
5659
static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = 4 * 1000 * 1000;
5760
/** Maximum length of the user agent string in `version` message */

src/net_processing.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,7 +2546,7 @@ void ProcessMessage(
25462546
if (!pfrom.IsAddrRelayPeer()) {
25472547
return;
25482548
}
2549-
if (vAddr.size() > 1000)
2549+
if (vAddr.size() > MAX_ADDR_TO_SEND)
25502550
{
25512551
LOCK(cs_main);
25522552
Misbehaving(pfrom.GetId(), 20, strprintf("addr message size = %u", vAddr.size()));
@@ -4064,8 +4064,8 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
40644064
{
40654065
pto->m_addr_known->insert(addr.GetKey());
40664066
vAddr.push_back(addr);
4067-
// receiver rejects addr messages larger than 1000
4068-
if (vAddr.size() >= 1000)
4067+
// receiver rejects addr messages larger than MAX_ADDR_TO_SEND
4068+
if (vAddr.size() >= MAX_ADDR_TO_SEND)
40694069
{
40704070
connman->PushMessage(pto, msgMaker.Make(NetMsgType::ADDR, vAddr));
40714071
vAddr.clear();

0 commit comments

Comments
 (0)