aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2021-01-31 20:36:24 +1000
committerAnthony Towns <aj@erisian.com.au>2021-02-26 23:55:10 +1000
commitee135c8d5b39b0cb8b301a83e286285ab926dca7 (patch)
tree952f654c4767b501d734041c94b12a0f23e66502 /src/net_processing.cpp
parent38a11c355acfc15134c682571b3d92f66b0e7c3c (diff)
txorphanage: Extract AddChildrenToWorkSet
Extract some common code into AddChildrenToWorkSet function. (It's a hard knock life)
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 01effa9245..181e64c77e 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -2121,14 +2121,7 @@ void PeerManagerImpl::ProcessOrphanTx(std::set<uint256>& orphan_work_set)
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s\n", orphanHash.ToString());
RelayTransaction(orphanHash, porphanTx->GetWitnessHash(), m_connman);
- for (unsigned int i = 0; i < porphanTx->vout.size(); i++) {
- auto it_by_prev = mapOrphanTransactionsByPrev.find(COutPoint(orphanHash, i));
- if (it_by_prev != mapOrphanTransactionsByPrev.end()) {
- for (const auto& elem : it_by_prev->second) {
- orphan_work_set.insert(elem->first);
- }
- }
- }
+ AddChildrenToWorkSet(*porphanTx, orphan_work_set);
EraseOrphanTx(orphanHash);
for (const CTransactionRef& removedTx : result.m_replaced_transactions.value()) {
AddToCompactExtraTransactions(removedTx);
@@ -3147,14 +3140,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
m_txrequest.ForgetTxHash(tx.GetHash());
m_txrequest.ForgetTxHash(tx.GetWitnessHash());
RelayTransaction(tx.GetHash(), tx.GetWitnessHash(), m_connman);
- for (unsigned int i = 0; i < tx.vout.size(); i++) {
- 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);
- }
- }
- }
+ AddChildrenToWorkSet(tx, peer->m_orphan_work_set);
pfrom.nLastTXTime = GetTime();