mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
Limit the number of new addressses to accumulate
Rebased-From: 12a49cac0a
This commit is contained in:
parent
cd5164aba2
commit
bb424e4447
@ -40,6 +40,8 @@ namespace boost {
|
|||||||
static const unsigned int MAX_INV_SZ = 50000;
|
static const unsigned int MAX_INV_SZ = 50000;
|
||||||
/** The maximum number of entries in mapAskFor */
|
/** The maximum number of entries in mapAskFor */
|
||||||
static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
|
static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
|
||||||
|
/** The maximum number of new addresses to accumulate before announcing. */
|
||||||
|
static const unsigned int MAX_ADDR_TO_SEND = 1000;
|
||||||
|
|
||||||
inline unsigned int ReceiveFloodSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }
|
inline unsigned int ReceiveFloodSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }
|
||||||
inline unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }
|
inline unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }
|
||||||
@ -400,9 +402,14 @@ public:
|
|||||||
// Known checking here is only to save space from duplicates.
|
// Known checking here is only to save space from duplicates.
|
||||||
// SendMessages will filter it again for knowns that were added
|
// SendMessages will filter it again for knowns that were added
|
||||||
// after addresses were pushed.
|
// after addresses were pushed.
|
||||||
if (addr.IsValid() && !setAddrKnown.count(addr))
|
if (addr.IsValid() && !setAddrKnown.count(addr)) {
|
||||||
|
if (vAddrToSend.size() >= MAX_ADDR_TO_SEND) {
|
||||||
|
vAddrToSend[insecure_rand() % vAddrToSend.size()] = addr;
|
||||||
|
} else {
|
||||||
vAddrToSend.push_back(addr);
|
vAddrToSend.push_back(addr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AddInventoryKnown(const CInv& inv)
|
void AddInventoryKnown(const CInv& inv)
|
||||||
|
Loading…
Reference in New Issue
Block a user