mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Merge pull request #7079
ebb25f4Limit setAskFor and retire requested entries only when a getdata returns. (Gregory Maxwell)5029698prevent peer flooding request queue for an inv (kazcw)
This commit is contained in:
@@ -2407,8 +2407,12 @@ CNode::~CNode()
|
||||
|
||||
void CNode::AskFor(const CInv& inv)
|
||||
{
|
||||
if (mapAskFor.size() > MAPASKFOR_MAX_SZ)
|
||||
if (mapAskFor.size() > MAPASKFOR_MAX_SZ || setAskFor.size() > SETASKFOR_MAX_SZ)
|
||||
return;
|
||||
// a peer may not have multiple non-responded queue positions for a single inv item
|
||||
if (!setAskFor.insert(inv.hash).second)
|
||||
return;
|
||||
|
||||
// We're using mapAskFor as a priority queue,
|
||||
// the key is the earliest time the request can be sent
|
||||
int64_t nRequestTime;
|
||||
|
||||
Reference in New Issue
Block a user