diff --git a/src/net_processing.cpp b/src/net_processing.cpp --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1982,17 +1982,16 @@ std::vector vNotFound; const CNetMsgMaker msgMaker(pfrom.GetSendVersion()); - // Note that if we receive a getdata for a MSG_TX from a block-relay-only - // outbound peer, we will stop processing further getdata messages from this - // peer (likely resulting in our peer eventually disconnecting us). - if (pfrom.m_tx_relay != nullptr) { - // mempool entries added before this time have likely expired from - // mapRelay - const std::chrono::seconds longlived_mempool_time = - GetTime() - RELAY_TX_CACHE_TIME; - const std::chrono::seconds mempool_req = - pfrom.m_tx_relay->m_last_mempool_req.load(); + // mempool entries added before this time have likely expired from mapRelay + const std::chrono::seconds longlived_mempool_time = + GetTime() - RELAY_TX_CACHE_TIME; + // Get last mempool request time + const std::chrono::seconds mempool_req = + pfrom.m_tx_relay != nullptr + ? pfrom.m_tx_relay->m_last_mempool_req.load() + : std::chrono::seconds::min(); + { LOCK(cs_main); while (it != pfrom.vRecvGetData.end() && it->type == MSG_TX) { @@ -2004,8 +2003,13 @@ break; } - const CInv &inv = *it; - it++; + const CInv &inv = *it++; + + if (pfrom.m_tx_relay == nullptr) { + // Ignore GETDATA requests for transactions from blocks-only + // peers. + continue; + } // Send stream from relay memory bool push = false;