Skip to content

Commit

Permalink
Actually only use filterInventoryKnown with MSG_TX inventory messages.
Browse files Browse the repository at this point in the history
Previously this logic could erroneously filter a MSG_BLOCK inventory message.
  • Loading branch information
gmaxwell authored and Fuzzbawls committed Jun 23, 2020
1 parent 9ac6b28 commit 070b6fb
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/main.cpp
Expand Up @@ -6397,7 +6397,7 @@ bool SendMessages(CNode* pto)
vInv.reserve(pto->vInventoryToSend.size());
vInvWait.reserve(pto->vInventoryToSend.size());
for (const CInv& inv : pto->vInventoryToSend) {
if (pto->filterInventoryKnown.contains(inv.hash))
if (inv.type == MSG_TX && pto->filterInventoryKnown.contains(inv.hash))
continue;

// trickle out tx inv to protect privacy
Expand All @@ -6416,13 +6416,12 @@ bool SendMessages(CNode* pto)
}
}

if (!pto->filterInventoryKnown.contains(inv.hash)) {
pto->filterInventoryKnown.insert(inv.hash);
vInv.push_back(inv);
if (vInv.size() >= 1000) {
pto->PushMessage(NetMsgType::INV, vInv);
vInv.clear();
}
pto->filterInventoryKnown.insert(inv.hash);

vInv.push_back(inv);
if (vInv.size() >= 1000) {
pto->PushMessage(NetMsgType::INV, vInv);
vInv.clear();
}
}
pto->vInventoryToSend = vInvWait;
Expand Down

0 comments on commit 070b6fb

Please sign in to comment.