mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-11 07:17:53 +00:00
Filter mempool command
This commit is contained in:
parent
e1a4f3778c
commit
c51694eb9b
@ -3446,12 +3446,15 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
else if (strCommand == "mempool")
|
else if (strCommand == "mempool")
|
||||||
{
|
{
|
||||||
std::vector<uint256> vtxid;
|
std::vector<uint256> vtxid;
|
||||||
|
LOCK2(mempool.cs, pfrom->cs_filter);
|
||||||
mempool.queryHashes(vtxid);
|
mempool.queryHashes(vtxid);
|
||||||
vector<CInv> vInv;
|
vector<CInv> vInv;
|
||||||
for (unsigned int i = 0; i < vtxid.size(); i++) {
|
BOOST_FOREACH(uint256& hash, vtxid) {
|
||||||
CInv inv(MSG_TX, vtxid[i]);
|
CInv inv(MSG_TX, hash);
|
||||||
|
if ((pfrom->pfilter && pfrom->pfilter->IsRelevantAndUpdate(mempool.lookup(hash), hash)) ||
|
||||||
|
(!pfrom->pfilter))
|
||||||
vInv.push_back(inv);
|
vInv.push_back(inv);
|
||||||
if (i == (MAX_INV_SZ - 1))
|
if (vInv.size() == MAX_INV_SZ)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (vInv.size() > 0)
|
if (vInv.size() > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user