Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 3,001 Lines • ▼ Show 20 Lines | while (!orphan_work_set.empty()) { | ||||
const CTransactionRef porphanTx = orphan_it->second.tx; | const CTransactionRef porphanTx = orphan_it->second.tx; | ||||
TxValidationState state; | TxValidationState state; | ||||
if (AcceptToMemoryPool(::ChainstateActive(), config, m_mempool, state, | if (AcceptToMemoryPool(::ChainstateActive(), config, m_mempool, state, | ||||
porphanTx, false /* bypass_limits */)) { | porphanTx, false /* bypass_limits */)) { | ||||
LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s\n", | LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s\n", | ||||
orphanTxId.ToString()); | orphanTxId.ToString()); | ||||
RelayTransaction(orphanTxId, m_connman); | RelayTransaction(orphanTxId, m_connman); | ||||
for (size_t i = 0; i < porphanTx->vout.size(); i++) { | AddChildrenToWorkSet(*porphanTx, orphan_work_set); | ||||
auto it_by_prev = | |||||
mapOrphanTransactionsByPrev.find(COutPoint(orphanTxId, i)); | |||||
if (it_by_prev != mapOrphanTransactionsByPrev.end()) { | |||||
for (const auto &elem : it_by_prev->second) { | |||||
orphan_work_set.insert(elem->first); | |||||
} | |||||
} | |||||
} | |||||
EraseOrphanTx(orphanTxId); | EraseOrphanTx(orphanTxId); | ||||
break; | break; | ||||
} else if (state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) { | } else if (state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) { | ||||
if (state.IsInvalid()) { | if (state.IsInvalid()) { | ||||
LogPrint(BCLog::MEMPOOL, | LogPrint(BCLog::MEMPOOL, | ||||
" invalid orphan tx %s from peer=%d. %s\n", | " invalid orphan tx %s from peer=%d. %s\n", | ||||
orphanTxId.ToString(), orphan_it->second.fromPeer, | orphanTxId.ToString(), orphan_it->second.fromPeer, | ||||
state.ToString()); | state.ToString()); | ||||
▲ Show 20 Lines • Show All 1,285 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::TX) { | ||||
if (AcceptToMemoryPool(::ChainstateActive(), config, m_mempool, state, | if (AcceptToMemoryPool(::ChainstateActive(), config, m_mempool, state, | ||||
ptx, false /* bypass_limits */)) { | ptx, false /* bypass_limits */)) { | ||||
m_mempool.check(m_chainman.ActiveChainstate()); | m_mempool.check(m_chainman.ActiveChainstate()); | ||||
// As this version of the transaction was acceptable, we can forget | // As this version of the transaction was acceptable, we can forget | ||||
// about any requests for it. | // about any requests for it. | ||||
m_txrequest.ForgetInvId(tx.GetId()); | m_txrequest.ForgetInvId(tx.GetId()); | ||||
RelayTransaction(tx.GetId(), m_connman); | RelayTransaction(tx.GetId(), m_connman); | ||||
for (size_t i = 0; i < tx.vout.size(); i++) { | AddChildrenToWorkSet(tx, peer->m_orphan_work_set); | ||||
auto it_by_prev = | |||||
mapOrphanTransactionsByPrev.find(COutPoint(txid, i)); | |||||
if (it_by_prev != mapOrphanTransactionsByPrev.end()) { | |||||
for (const auto &elem : it_by_prev->second) { | |||||
peer->m_orphan_work_set.insert(elem->first); | |||||
} | |||||
} | |||||
} | |||||
pfrom.m_last_tx_time = GetTime<std::chrono::seconds>(); | pfrom.m_last_tx_time = GetTime<std::chrono::seconds>(); | ||||
LogPrint(BCLog::MEMPOOL, | LogPrint(BCLog::MEMPOOL, | ||||
"AcceptToMemoryPool: peer=%d: accepted %s " | "AcceptToMemoryPool: peer=%d: accepted %s " | ||||
"(poolsz %u txn, %u kB)\n", | "(poolsz %u txn, %u kB)\n", | ||||
pfrom.GetId(), tx.GetId().ToString(), m_mempool.size(), | pfrom.GetId(), tx.GetId().ToString(), m_mempool.size(), | ||||
m_mempool.DynamicMemoryUsage() / 1000); | m_mempool.DynamicMemoryUsage() / 1000); | ||||
▲ Show 20 Lines • Show All 2,576 Lines • Show Last 20 Lines |