Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 2,179 Lines • ▼ Show 20 Lines | while (it != pfrom.vRecvGetData.end()) { | ||||
FindTxForGetData(mempool, pfrom, txid, mempool_req, now); | FindTxForGetData(mempool, 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); | 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) { | std::vector<TxId> parent_ids_to_add; | ||||
auto txinfo = mempool.info(txin.prevout.GetTxId()); | { | ||||
if (txinfo.tx && | LOCK(mempool.cs); | ||||
txinfo.m_time > now - UNCONDITIONAL_RELAY_DELAY) { | auto txiter = mempool.GetIter(tx->GetId()); | ||||
if (txiter) { | |||||
const CTxMemPool::setEntries &parents = | |||||
mempool.GetMemPoolParents(*txiter); | |||||
parent_ids_to_add.reserve(parents.size()); | |||||
for (CTxMemPool::txiter parent_iter : parents) { | |||||
if (parent_iter->GetTime() > | |||||
now - UNCONDITIONAL_RELAY_DELAY) { | |||||
parent_ids_to_add.push_back( | |||||
parent_iter->GetTx().GetId()); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
for (const TxId &parent_txid : parent_ids_to_add) { | |||||
// Relaying a transaction with a recent but unconfirmed | // Relaying a transaction with a recent but unconfirmed | ||||
// parent. | // parent. | ||||
if (WITH_LOCK( | if (WITH_LOCK(pfrom.m_tx_relay->cs_tx_inventory, | ||||
pfrom.m_tx_relay->cs_tx_inventory, | |||||
return !pfrom.m_tx_relay->filterInventoryKnown | return !pfrom.m_tx_relay->filterInventoryKnown | ||||
.contains( | .contains(parent_txid))) { | ||||
txin.prevout.GetTxId()))) { | |||||
LOCK(cs_main); | LOCK(cs_main); | ||||
State(pfrom.GetId()) | State(pfrom.GetId()) | ||||
->m_recently_announced_invs.insert( | ->m_recently_announced_invs.insert(parent_txid); | ||||
txin.prevout.GetTxId()); | |||||
} | |||||
} | } | ||||
} | } | ||||
} else { | } else { | ||||
vNotFound.push_back(inv); | vNotFound.push_back(inv); | ||||
} | } | ||||
++it; | ++it; | ||||
continue; | continue; | ||||
▲ Show 20 Lines • Show All 3,713 Lines • Show Last 20 Lines |