Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 1,983 Lines • ▼ Show 20 Lines | CTransactionRef static FindTxForGetData( | ||||
// know we already have it. | // know we already have it. | ||||
{ | { | ||||
LOCK(peer.m_tx_relay->cs_tx_inventory); | LOCK(peer.m_tx_relay->cs_tx_inventory); | ||||
if (peer.m_tx_relay->setInventoryTxToSend.count(txid)) { | if (peer.m_tx_relay->setInventoryTxToSend.count(txid)) { | ||||
return {}; | return {}; | ||||
} | } | ||||
} | } | ||||
{ | |||||
LOCK(cs_main); | |||||
// Look up transaction in relay pool | |||||
auto mi = mapRelay.find(txid); | |||||
if (mi != mapRelay.end()) { | |||||
return mi->second; | |||||
} | |||||
} | |||||
auto txinfo = g_mempool.info(txid); | auto txinfo = g_mempool.info(txid); | ||||
if (txinfo.tx) { | if (txinfo.tx) { | ||||
// To protect privacy, do not answer getdata using the mempool when | // To protect privacy, do not answer getdata using the mempool when | ||||
// that TX couldn't have been INVed in reply to a MEMPOOL request, | // that TX couldn't have been INVed in reply to a MEMPOOL request, | ||||
// or when it's too recent to have expired from mapRelay. | // or when it's too recent to have expired from mapRelay. | ||||
if ((mempool_req.count() && txinfo.m_time <= mempool_req) || | if ((mempool_req.count() && txinfo.m_time <= mempool_req) || | ||||
txinfo.m_time <= longlived_mempool_time) { | txinfo.m_time <= longlived_mempool_time) { | ||||
return txinfo.tx; | return txinfo.tx; | ||||
} | } | ||||
} | } | ||||
{ | |||||
LOCK(cs_main); | |||||
// Look up transaction in relay pool | |||||
auto mi = mapRelay.find(txid); | |||||
if (mi != mapRelay.end()) { | |||||
return mi->second; | |||||
} | |||||
} | |||||
return {}; | return {}; | ||||
} | } | ||||
static void ProcessGetData(const Config &config, CNode &pfrom, | static void ProcessGetData(const Config &config, CNode &pfrom, | ||||
CConnman &connman, CTxMemPool &mempool, | CConnman &connman, CTxMemPool &mempool, | ||||
const std::atomic<bool> &interruptMsgProc) | const std::atomic<bool> &interruptMsgProc) | ||||
LOCKS_EXCLUDED(cs_main) { | LOCKS_EXCLUDED(cs_main) { | ||||
AssertLockNotHeld(cs_main); | AssertLockNotHeld(cs_main); | ||||
▲ Show 20 Lines • Show All 3,572 Lines • Show Last 20 Lines |