Skip to content

Commit

Permalink
Don't do mempool lookups for "mempool" command without a filter
Browse files Browse the repository at this point in the history
Github-Pull: #7174
Rebased-From: 96918a2
  • Loading branch information
TheBlueMatt authored and laanwj committed Dec 7, 2015
1 parent f31955d commit 82aff88
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main.cpp
Expand Up @@ -4994,12 +4994,13 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
vector<CInv> vInv; vector<CInv> vInv;
BOOST_FOREACH(uint256& hash, vtxid) { BOOST_FOREACH(uint256& hash, vtxid) {
CInv inv(MSG_TX, hash); CInv inv(MSG_TX, hash);
CTransaction tx; if (pfrom->pfilter) {
bool fInMemPool = mempool.lookup(hash, tx); CTransaction tx;
if (!fInMemPool) continue; // another thread removed since queryHashes, maybe... bool fInMemPool = mempool.lookup(hash, tx);
if ((pfrom->pfilter && pfrom->pfilter->IsRelevantAndUpdate(tx)) || if (!fInMemPool) continue; // another thread removed since queryHashes, maybe...
(!pfrom->pfilter)) if (!pfrom->pfilter->IsRelevantAndUpdate(tx)) continue;
vInv.push_back(inv); }
vInv.push_back(inv);
if (vInv.size() == MAX_INV_SZ) { if (vInv.size() == MAX_INV_SZ) {
pfrom->PushMessage("inv", vInv); pfrom->PushMessage("inv", vInv);
vInv.clear(); vInv.clear();
Expand Down

0 comments on commit 82aff88

Please sign in to comment.