Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -887,10 +887,15 @@ class CNode


void AddInventoryKnown(const CInv& inv)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, this one is not used in this PR, but will later be used in the LLMQ code

{
AddInventoryKnown(inv.hash);
}

void AddInventoryKnown(const uint256& hash)
{
{
LOCK(cs_inventory);
filterInventoryKnown.insert(inv.hash);
filterInventoryKnown.insert(hash);
}
}

Expand All @@ -908,8 +913,12 @@ class CNode
LogPrint("net", "PushInventory -- inv: %s peer=%d\n", inv.ToString(), id);
vInventoryBlockToSend.push_back(inv.hash);
} else {
LogPrint("net", "PushInventory -- inv: %s peer=%d\n", inv.ToString(), id);
vInventoryOtherToSend.push_back(inv);
if (!filterInventoryKnown.contains(inv.hash)) {
LogPrint("net", "PushInventory -- inv: %s peer=%d\n", inv.ToString(), id);
vInventoryOtherToSend.push_back(inv);
} else {
LogPrint("net", "PushInventory -- filtered inv: %s peer=%d\n", inv.ToString(), id);
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3431,7 +3431,11 @@ bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interr

// Send non-tx/non-block inventory items
for (const auto& inv : pto->vInventoryOtherToSend) {
if (pto->filterInventoryKnown.contains(inv.hash)) {
continue;
}
vInv.push_back(inv);
pto->filterInventoryKnown.insert(inv.hash);
if (vInv.size() == MAX_INV_SZ) {
connman.PushMessage(pto, msgMaker.Make(NetMsgType::INV, vInv));
vInv.clear();
Expand Down