aboutsummaryrefslogtreecommitdiff
path: root/src/txorphanage.cpp
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2021-02-25 00:03:23 +1000
committerAnthony Towns <aj@erisian.com.au>2022-10-11 14:04:49 +1000
commit3614819864a84ac32f6d53c6ace79b5e71bc174a (patch)
tree94cf6c60a71d3da7cb7ed1a6f9e4d0a763cc843e /src/txorphanage.cpp
parent6f8e442ba61378489a6e2e2ab5bcfbccca1a29ec (diff)
txorphange: move orphan workset to txorphanage
Diffstat (limited to 'src/txorphanage.cpp')
-rw-r--r--src/txorphanage.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/txorphanage.cpp b/src/txorphanage.cpp
index 69ae8ea582..d26a84b0ef 100644
--- a/src/txorphanage.cpp
+++ b/src/txorphanage.cpp
@@ -89,6 +89,8 @@ void TxOrphanage::EraseForPeer(NodeId peer)
{
AssertLockHeld(g_cs_orphans);
+ m_peer_work_set.erase(peer);
+
int nErased = 0;
std::map<uint256, OrphanTx>::iterator iter = m_orphans.begin();
while (iter != m_orphans.end())
@@ -138,9 +140,13 @@ 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, std::set<uint256>& orphan_work_set) const
+void TxOrphanage::AddChildrenToWorkSet(const CTransaction& tx, NodeId peer)
{
AssertLockHeld(g_cs_orphans);
+
+ // 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()) {