@@ -1595,15 +1595,13 @@ void static ProcessGetData(CNode* pfrom, const CChainParams& chainparams, CConnm
15951595 std::vector<CInv> vNotFound;
15961596 const CNetMsgMaker msgMaker (pfrom->GetSendVersion ());
15971597
1598- // Note that if we receive a getdata for a MSG_TX or MSG_WITNESS_TX from a
1599- // block-relay-only outbound peer, we will stop processing further getdata
1600- // messages from this peer (likely resulting in our peer eventually
1601- // disconnecting us).
1602- if (pfrom->m_tx_relay != nullptr ) {
1603- // mempool entries added before this time have likely expired from mapRelay
1604- const std::chrono::seconds longlived_mempool_time = GetTime<std::chrono::seconds>() - RELAY_TX_CACHE_TIME;
1605- const std::chrono::seconds mempool_req = pfrom->m_tx_relay ->m_last_mempool_req .load ();
1598+ // mempool entries added before this time have likely expired from mapRelay
1599+ const std::chrono::seconds longlived_mempool_time = GetTime<std::chrono::seconds>() - RELAY_TX_CACHE_TIME;
1600+ // Get last mempool request time
1601+ const std::chrono::seconds mempool_req = pfrom->m_tx_relay != nullptr ? pfrom->m_tx_relay ->m_last_mempool_req .load ()
1602+ : std::chrono::seconds::min ();
16061603
1604+ {
16071605 LOCK (cs_main);
16081606
16091607 while (it != pfrom->vRecvGetData .end () && (it->type == MSG_TX || it->type == MSG_WITNESS_TX)) {
@@ -1613,8 +1611,12 @@ void static ProcessGetData(CNode* pfrom, const CChainParams& chainparams, CConnm
16131611 if (pfrom->fPauseSend )
16141612 break ;
16151613
1616- const CInv &inv = *it;
1617- it++;
1614+ const CInv &inv = *it++;
1615+
1616+ if (pfrom->m_tx_relay == nullptr ) {
1617+ // Ignore GETDATA requests for transactions from blocks-only peers.
1618+ continue ;
1619+ }
16181620
16191621 // Send stream from relay memory
16201622 bool push = false ;
0 commit comments