mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
Remove useless 2500 limit on AddrMan queries
This commit is contained in:
parent
ded742bc5b
commit
7cc0e8101f
3 changed files with 7 additions and 4 deletions
|
@ -157,7 +157,7 @@ public:
|
|||
#define ADDRMAN_GETADDR_MAX_PCT 23
|
||||
|
||||
//! the maximum number of nodes to return in a getaddr call
|
||||
#define ADDRMAN_GETADDR_MAX 2500
|
||||
#define ADDRMAN_GETADDR_MAX 1000
|
||||
|
||||
//! Convenience
|
||||
#define ADDRMAN_TRIED_BUCKET_COUNT (1 << ADDRMAN_TRIED_BUCKET_COUNT_LOG2)
|
||||
|
|
|
@ -52,6 +52,9 @@ static const int TIMEOUT_INTERVAL = 20 * 60;
|
|||
static const int FEELER_INTERVAL = 120;
|
||||
/** The maximum number of new addresses to accumulate before announcing. */
|
||||
static const unsigned int MAX_ADDR_TO_SEND = 1000;
|
||||
// TODO: remove ADDRMAN_GETADDR_MAX and let the caller specify this limit with MAX_ADDR_TO_SEND.
|
||||
static_assert(MAX_ADDR_TO_SEND == ADDRMAN_GETADDR_MAX,
|
||||
"Max allowed ADDR message size should be equal to the max number of records returned from AddrMan.");
|
||||
/** Maximum length of incoming protocol messages (no message over 4 MB is currently acceptable). */
|
||||
static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = 4 * 1000 * 1000;
|
||||
/** Maximum length of the user agent string in `version` message */
|
||||
|
|
|
@ -2546,7 +2546,7 @@ void ProcessMessage(
|
|||
if (!pfrom.IsAddrRelayPeer()) {
|
||||
return;
|
||||
}
|
||||
if (vAddr.size() > 1000)
|
||||
if (vAddr.size() > MAX_ADDR_TO_SEND)
|
||||
{
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pfrom.GetId(), 20, strprintf("addr message size = %u", vAddr.size()));
|
||||
|
@ -4064,8 +4064,8 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
|
|||
{
|
||||
pto->m_addr_known->insert(addr.GetKey());
|
||||
vAddr.push_back(addr);
|
||||
// receiver rejects addr messages larger than 1000
|
||||
if (vAddr.size() >= 1000)
|
||||
// receiver rejects addr messages larger than MAX_ADDR_TO_SEND
|
||||
if (vAddr.size() >= MAX_ADDR_TO_SEND)
|
||||
{
|
||||
connman->PushMessage(pto, msgMaker.Make(NetMsgType::ADDR, vAddr));
|
||||
vAddr.clear();
|
||||
|
|
Loading…
Add table
Reference in a new issue