Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 2,133 Lines • ▼ Show 20 Lines | while (it != pfrom.vRecvGetData.end()) { | ||||
// the buffer, pause processing until the next call. | // the buffer, pause processing until the next call. | ||||
if (pfrom.fPauseSend) { | if (pfrom.fPauseSend) { | ||||
break; | break; | ||||
} | } | ||||
const CInv &inv = *it; | const CInv &inv = *it; | ||||
if (it->IsMsgProof()) { | if (it->IsMsgProof()) { | ||||
const avalanche::ProofId proofid = avalanche::ProofId{inv.hash}; | const avalanche::ProofId proofid(inv.hash); | ||||
auto proof = FindProofForGetData(pfrom, proofid, now); | auto proof = FindProofForGetData(pfrom, proofid, now); | ||||
if (proof) { | if (proof) { | ||||
connman.PushMessage( | connman.PushMessage( | ||||
&pfrom, msgMaker.Make(NetMsgType::AVAPROOF, *proof)); | &pfrom, msgMaker.Make(NetMsgType::AVAPROOF, *proof)); | ||||
g_avalanche->removeUnbroadcastProof(proofid); | g_avalanche->removeUnbroadcastProof(proofid); | ||||
} else { | } else { | ||||
vNotFound.push_back(inv); | vNotFound.push_back(inv); | ||||
} | } | ||||
++it; | ++it; | ||||
continue; | continue; | ||||
} | } | ||||
if (it->IsMsgTx()) { | if (it->IsMsgTx()) { | ||||
if (pfrom.m_tx_relay == nullptr) { | if (pfrom.m_tx_relay == nullptr) { | ||||
// Ignore GETDATA requests for transactions from blocks-only | // Ignore GETDATA requests for transactions from blocks-only | ||||
// peers. | // peers. | ||||
continue; | continue; | ||||
} | } | ||||
const TxId txid(inv.hash); | |||||
CTransactionRef tx = | CTransactionRef tx = | ||||
FindTxForGetData(pfrom, TxId{inv.hash}, mempool_req, now); | FindTxForGetData(pfrom, txid, mempool_req, now); | ||||
if (tx) { | if (tx) { | ||||
int nSendFlags = 0; | int nSendFlags = 0; | ||||
connman.PushMessage( | connman.PushMessage( | ||||
&pfrom, msgMaker.Make(nSendFlags, NetMsgType::TX, *tx)); | &pfrom, msgMaker.Make(nSendFlags, NetMsgType::TX, *tx)); | ||||
mempool.RemoveUnbroadcastTx(TxId(inv.hash)); | mempool.RemoveUnbroadcastTx(txid); | ||||
// As we're going to send tx, make sure its unconfirmed parents | // As we're going to send tx, make sure its unconfirmed parents | ||||
// are made requestable. | // are made requestable. | ||||
for (const auto &txin : tx->vin) { | for (const auto &txin : tx->vin) { | ||||
auto txinfo = mempool.info(txin.prevout.GetTxId()); | auto txinfo = mempool.info(txin.prevout.GetTxId()); | ||||
if (txinfo.tx && | if (txinfo.tx && | ||||
txinfo.m_time > now - UNCONDITIONAL_RELAY_DELAY) { | txinfo.m_time > now - UNCONDITIONAL_RELAY_DELAY) { | ||||
// Relaying a transaction with a recent but unconfirmed | // Relaying a transaction with a recent but unconfirmed | ||||
// parent. | // parent. | ||||
▲ Show 20 Lines • Show All 3,690 Lines • Show Last 20 Lines |