diff options
author | Matt Corallo <git@bluematt.me> | 2013-01-10 14:06:30 -0500 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2013-01-16 14:34:06 -0500 |
commit | c51694eb9b9db915beb1da8d76667d94f4f74c75 (patch) | |
tree | 161428fb5664923122a58824896592aac3d38685 /src | |
parent | e1a4f3778cb90ba9f0d4e736752f78dad1703caa (diff) |
Filter mempool command
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp index 644c5d0e6d..1eb4124c16 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3446,13 +3446,16 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) else if (strCommand == "mempool") { std::vector<uint256> vtxid; + LOCK2(mempool.cs, pfrom->cs_filter); mempool.queryHashes(vtxid); vector<CInv> vInv; - for (unsigned int i = 0; i < vtxid.size(); i++) { - CInv inv(MSG_TX, vtxid[i]); - vInv.push_back(inv); - if (i == (MAX_INV_SZ - 1)) - break; + BOOST_FOREACH(uint256& hash, vtxid) { + CInv inv(MSG_TX, hash); + if ((pfrom->pfilter && pfrom->pfilter->IsRelevantAndUpdate(mempool.lookup(hash), hash)) || + (!pfrom->pfilter)) + vInv.push_back(inv); + if (vInv.size() == MAX_INV_SZ) + break; } if (vInv.size() > 0) pfrom->PushMessage("inv", vInv); |