mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-02 15:32:34 +02:00
Remove useless 2500 limit on AddrMan queries
This commit is contained in:
parent
ded742bc5b
commit
7cc0e8101f
@ -157,7 +157,7 @@ public:
|
|||||||
#define ADDRMAN_GETADDR_MAX_PCT 23
|
#define ADDRMAN_GETADDR_MAX_PCT 23
|
||||||
|
|
||||||
//! the maximum number of nodes to return in a getaddr call
|
//! the maximum number of nodes to return in a getaddr call
|
||||||
#define ADDRMAN_GETADDR_MAX 2500
|
#define ADDRMAN_GETADDR_MAX 1000
|
||||||
|
|
||||||
//! Convenience
|
//! Convenience
|
||||||
#define ADDRMAN_TRIED_BUCKET_COUNT (1 << ADDRMAN_TRIED_BUCKET_COUNT_LOG2)
|
#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;
|
static const int FEELER_INTERVAL = 120;
|
||||||
/** The maximum number of new addresses to accumulate before announcing. */
|
/** The maximum number of new addresses to accumulate before announcing. */
|
||||||
static const unsigned int MAX_ADDR_TO_SEND = 1000;
|
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). */
|
/** 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;
|
static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = 4 * 1000 * 1000;
|
||||||
/** Maximum length of the user agent string in `version` message */
|
/** Maximum length of the user agent string in `version` message */
|
||||||
|
@ -2546,7 +2546,7 @@ void ProcessMessage(
|
|||||||
if (!pfrom.IsAddrRelayPeer()) {
|
if (!pfrom.IsAddrRelayPeer()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (vAddr.size() > 1000)
|
if (vAddr.size() > MAX_ADDR_TO_SEND)
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
Misbehaving(pfrom.GetId(), 20, strprintf("addr message size = %u", vAddr.size()));
|
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());
|
pto->m_addr_known->insert(addr.GetKey());
|
||||||
vAddr.push_back(addr);
|
vAddr.push_back(addr);
|
||||||
// receiver rejects addr messages larger than 1000
|
// receiver rejects addr messages larger than MAX_ADDR_TO_SEND
|
||||||
if (vAddr.size() >= 1000)
|
if (vAddr.size() >= MAX_ADDR_TO_SEND)
|
||||||
{
|
{
|
||||||
connman->PushMessage(pto, msgMaker.Make(NetMsgType::ADDR, vAddr));
|
connman->PushMessage(pto, msgMaker.Make(NetMsgType::ADDR, vAddr));
|
||||||
vAddr.clear();
|
vAddr.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user