Skip to content

Commit 96918a2

Browse files
committed
Don't do mempool lookups for "mempool" command without a filter
1 parent 7922592 commit 96918a2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4994,12 +4994,13 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
49944994
vector<CInv> vInv;
49954995
BOOST_FOREACH(uint256& hash, vtxid) {
49964996
CInv inv(MSG_TX, hash);
4997-
CTransaction tx;
4998-
bool fInMemPool = mempool.lookup(hash, tx);
4999-
if (!fInMemPool) continue; // another thread removed since queryHashes, maybe...
5000-
if ((pfrom->pfilter && pfrom->pfilter->IsRelevantAndUpdate(tx)) ||
5001-
(!pfrom->pfilter))
5002-
vInv.push_back(inv);
4997+
if (pfrom->pfilter) {
4998+
CTransaction tx;
4999+
bool fInMemPool = mempool.lookup(hash, tx);
5000+
if (!fInMemPool) continue; // another thread removed since queryHashes, maybe...
5001+
if (!pfrom->pfilter->IsRelevantAndUpdate(tx)) continue;
5002+
}
5003+
vInv.push_back(inv);
50035004
if (vInv.size() == MAX_INV_SZ) {
50045005
pfrom->PushMessage("inv", vInv);
50055006
vInv.clear();

0 commit comments

Comments
 (0)