0    if (!Assume(m_mempool)) return false;
It would be nice if this function wasn’t called when no mempool exists. If you agree, I think it makes sense to skip calling this function when txs aren’t expected at all:
 0diff --git a/src/net_processing.cpp b/src/net_processing.cpp
 1index 3ad34e83ba..68e381db60 100644
 2--- a/src/net_processing.cpp
 3+++ b/src/net_processing.cpp
 4@@ -2949,16 +2949,17 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
 5                     best_block = &inv.hash;
 6                 }
 7             } else if (inv.IsGenTxMsg()) {
 8+                if (fBlocksOnly) {
 9+                    LogPrint(BCLog::NET, "transaction (%s) inv sent in violation of protocol, disconnecting peer=%d\n", inv.hash.ToString(), pfrom.GetId());
10+                    pfrom.fDisconnect = true;
11+                    return;
12+                }
13                 const GenTxid gtxid = ToGenTxid(inv);
14                 const bool fAlreadyHave = AlreadyHaveTx(gtxid);
15                 LogPrint(BCLog::NET, "got inv: %s  %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom.GetId());
16 
17                 pfrom.AddKnownTx(inv.hash);
18-                if (fBlocksOnly) {
19-                    LogPrint(BCLog::NET, "transaction (%s) inv sent in violation of protocol, disconnecting peer=%d\n", inv.hash.ToString(), pfrom.GetId());
20-                    pfrom.fDisconnect = true;
21-                    return;
22-                } else if (!fAlreadyHave && !m_chainman.ActiveChainstate().IsInitialBlockDownload()) {
23+                if (!fAlreadyHave && !m_chainman.ActiveChainstate().IsInitialBlockDownload()) {
24                     AddTxAnnouncement(pfrom, gtxid, current_time);
25                 }
26             } else {
Should be done in a separate commit, or even separate pull