From 68bc68fd8bdd8a618deea213220e8c0664127151 Mon Sep 17 00:00:00 2001 From: furszy Date: Mon, 28 Dec 2020 20:35:36 -0300 Subject: [PATCH] Don't do mempool lookups for "mempool" command without a filter Coming from btc@96918a2f0990a8207d7631b8de73af8ae5d24aeb --- src/net_processing.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 39309645908e1..73ccd5ca9e1b6 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1640,12 +1640,13 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR std::vector vInv; for (uint256& hash : vtxid) { CInv inv(MSG_TX, hash); - CTransaction tx; - bool fInMemPool = mempool.lookup(hash, tx); - if (!fInMemPool) continue; // another thread removed since queryHashes, maybe... - if ((pfrom->pfilter && pfrom->pfilter->IsRelevantAndUpdate(tx)) || - (!pfrom->pfilter)) - vInv.push_back(inv); + if (pfrom->pfilter) { + CTransaction tx; + bool fInMemPool = mempool.lookup(hash, tx); + if (!fInMemPool) continue; // another thread removed since queryHashes, maybe... + if (!pfrom->pfilter->IsRelevantAndUpdate(tx)) continue; + } + vInv.emplace_back(inv); if (vInv.size() == MAX_INV_SZ) { connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::INV, vInv)); vInv.clear();