diff options
author | Anthony Towns <aj@erisian.com.au> | 2021-03-25 14:13:45 +1000 |
---|---|---|
committer | Anthony Towns <aj@erisian.com.au> | 2022-11-29 09:03:57 +1000 |
commit | a4fe09973aa82210b98dcb4e4e9f11ef59780f9b (patch) | |
tree | 5dfbdc1a79d3cd27c065ba4c9af1c8cab628b7ba /src/txorphanage.cpp | |
parent | d415b7261c05dafbc3e65eea72d270b2bed0958b (diff) |
txorphanage: index workset by originating peer
Diffstat (limited to 'src/txorphanage.cpp')
-rw-r--r-- | src/txorphanage.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/txorphanage.cpp b/src/txorphanage.cpp index b0b71e135c..2dbc73cbca 100644 --- a/src/txorphanage.cpp +++ b/src/txorphanage.cpp @@ -145,17 +145,19 @@ void TxOrphanage::LimitOrphans(unsigned int max_orphans) if (nEvicted > 0) LogPrint(BCLog::MEMPOOL, "orphanage overflow, removed %u tx\n", nEvicted); } -void TxOrphanage::AddChildrenToWorkSet(const CTransaction& tx, NodeId peer) +void TxOrphanage::AddChildrenToWorkSet(const CTransaction& tx) { LOCK(m_mutex); - // Get this peer's work set, emplacing an empty set it didn't exist - std::set<uint256>& orphan_work_set = m_peer_work_set.try_emplace(peer).first->second; for (unsigned int i = 0; i < tx.vout.size(); i++) { const auto it_by_prev = m_outpoint_to_orphan_it.find(COutPoint(tx.GetHash(), i)); if (it_by_prev != m_outpoint_to_orphan_it.end()) { for (const auto& elem : it_by_prev->second) { + // Get this source peer's work set, emplacing an empty set if it didn't exist + // (note: if this peer wasn't still connected, we would have removed the orphan tx already) + std::set<uint256>& orphan_work_set = m_peer_work_set.try_emplace(elem->second.fromPeer).first->second; + // Add this tx to the work set orphan_work_set.insert(elem->first); } } |