@@ -368,9 +368,6 @@ struct Peer {
368
368
/* * Total number of addresses that were processed (excludes rate-limited ones). */
369
369
std::atomic<uint64_t > m_addr_processed{0 };
370
370
371
- /* * Set of txids to reconsider once their parent transactions have been accepted **/
372
- std::set<uint256> m_orphan_work_set GUARDED_BY (g_cs_orphans);
373
-
374
371
/* * Whether we've sent this peer a getheaders in response to an inv prior to initial-headers-sync completing */
375
372
bool m_inv_triggered_getheaders_before_sync GUARDED_BY (NetEventsInterface::g_msgproc_mutex){false };
376
373
@@ -2890,11 +2887,14 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
2890
2887
AssertLockHeld (cs_main);
2891
2888
AssertLockHeld (g_cs_orphans);
2892
2889
2893
- if (peer.m_orphan_work_set .empty ()) return false ;
2890
+ auto work_set_it = m_orphanage.m_peer_work_set .find (peer.m_id );
2891
+ if (work_set_it == m_orphanage.m_peer_work_set .end ()) return false ;
2892
+
2893
+ std::set<uint256>& orphan_work_set = work_set_it->second ;
2894
2894
2895
- while (!peer. m_orphan_work_set .empty ()) {
2896
- const uint256 orphanHash = *peer. m_orphan_work_set .begin ();
2897
- peer. m_orphan_work_set . erase (peer. m_orphan_work_set .begin ());
2895
+ while (!orphan_work_set .empty ()) {
2896
+ const uint256 orphanHash = *orphan_work_set .begin ();
2897
+ orphan_work_set. erase (orphan_work_set .begin ());
2898
2898
2899
2899
const auto [porphanTx, from_peer] = m_orphanage.GetTx (orphanHash);
2900
2900
if (porphanTx == nullptr ) continue ;
@@ -2905,7 +2905,7 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
2905
2905
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
2906
2906
LogPrint (BCLog::MEMPOOL, " accepted orphan tx %s\n " , orphanHash.ToString ());
2907
2907
RelayTransaction (orphanHash, porphanTx->GetWitnessHash ());
2908
- m_orphanage.AddChildrenToWorkSet (*porphanTx, peer.m_orphan_work_set );
2908
+ m_orphanage.AddChildrenToWorkSet (*porphanTx, peer.m_id );
2909
2909
m_orphanage.EraseTx (orphanHash);
2910
2910
for (const CTransactionRef& removedTx : result.m_replaced_transactions .value ()) {
2911
2911
AddToCompactExtraTransactions (removedTx);
@@ -2957,7 +2957,7 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
2957
2957
}
2958
2958
}
2959
2959
2960
- return !peer. m_orphan_work_set .empty ();
2960
+ return !orphan_work_set .empty ();
2961
2961
}
2962
2962
2963
2963
bool PeerManagerImpl::PrepareBlockFilterRequest (CNode& node, Peer& peer,
@@ -3950,7 +3950,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
3950
3950
m_txrequest.ForgetTxHash (tx.GetHash ());
3951
3951
m_txrequest.ForgetTxHash (tx.GetWitnessHash ());
3952
3952
RelayTransaction (tx.GetHash (), tx.GetWitnessHash ());
3953
- m_orphanage.AddChildrenToWorkSet (tx, peer->m_orphan_work_set );
3953
+ m_orphanage.AddChildrenToWorkSet (tx, peer->m_id );
3954
3954
3955
3955
pfrom.m_last_tx_time = GetTime<std::chrono::seconds>();
3956
3956
0 commit comments