Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 2,050 Lines • ▼ Show 20 Lines | static void ProcessGetData(const Config &config, CNode &pfrom, | ||||
const std::chrono::seconds mempool_req = | const std::chrono::seconds mempool_req = | ||||
pfrom.m_tx_relay != nullptr | pfrom.m_tx_relay != nullptr | ||||
? pfrom.m_tx_relay->m_last_mempool_req.load() | ? pfrom.m_tx_relay->m_last_mempool_req.load() | ||||
: std::chrono::seconds::min(); | : std::chrono::seconds::min(); | ||||
// Process as many TX items from the front of the getdata queue as | // Process as many TX items from the front of the getdata queue as | ||||
// possible, since they're common and it's efficient to batch process | // possible, since they're common and it's efficient to batch process | ||||
// them. | // them. | ||||
while (it != pfrom.vRecvGetData.end() && it->type == MSG_TX) { | while (it != pfrom.vRecvGetData.end() && it->IsMsgTx()) { | ||||
if (interruptMsgProc) { | if (interruptMsgProc) { | ||||
return; | return; | ||||
} | } | ||||
// The send buffer provides backpressure. If there's no space in | // The send buffer provides backpressure. If there's no space in | ||||
// the buffer, pause processing until the next call. | // the buffer, pause processing until the next call. | ||||
if (pfrom.fPauseSend) { | if (pfrom.fPauseSend) { | ||||
break; | break; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,372 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::NOTFOUND) { | ||||
// Remove the NOTFOUND transactions from the peer | // Remove the NOTFOUND transactions from the peer | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
CNodeState *state = State(pfrom.GetId()); | CNodeState *state = State(pfrom.GetId()); | ||||
std::vector<CInv> vInv; | std::vector<CInv> vInv; | ||||
vRecv >> vInv; | vRecv >> vInv; | ||||
if (vInv.size() <= | if (vInv.size() <= | ||||
MAX_PEER_TX_IN_FLIGHT + MAX_BLOCKS_IN_TRANSIT_PER_PEER) { | MAX_PEER_TX_IN_FLIGHT + MAX_BLOCKS_IN_TRANSIT_PER_PEER) { | ||||
for (CInv &inv : vInv) { | for (CInv &inv : vInv) { | ||||
if (inv.type == MSG_TX) { | if (inv.IsMsgTx()) { | ||||
const TxId txid(inv.hash); | const TxId txid(inv.hash); | ||||
// If we receive a NOTFOUND message for a txid we requested, | // If we receive a NOTFOUND message for a txid we requested, | ||||
// erase it from our data structures for this peer. | // erase it from our data structures for this peer. | ||||
auto in_flight_it = | auto in_flight_it = | ||||
state->m_tx_download.m_tx_in_flight.find(txid); | state->m_tx_download.m_tx_in_flight.find(txid); | ||||
if (in_flight_it == | if (in_flight_it == | ||||
state->m_tx_download.m_tx_in_flight.end()) { | state->m_tx_download.m_tx_in_flight.end()) { | ||||
// Skip any further work if this is a spurious NOTFOUND | // Skip any further work if this is a spurious NOTFOUND | ||||
▲ Show 20 Lines • Show All 1,164 Lines • Show Last 20 Lines |