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
 Coming from btc@96918a2f0990a8207d7631b8de73af8ae5d24aeb
  • Loading branch information
furszy committed Jan 18, 2021
1 parent 7624823 commit 68bc68f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1640,12 +1640,13 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
std::vector<CInv> 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();
Expand Down

0 comments on commit 68bc68f

Please sign in to comment.