@@ -513,7 +513,7 @@ struct Peer {
513
513
bool m_should_discourage GUARDED_BY (m_misbehavior_mutex){false };
514
514
515
515
/* * Set of txids to reconsider once their parent transactions have been accepted **/
516
- std::set<uint256> m_orphan_work_set;
516
+ std::set<uint256> m_orphan_work_set GUARDED_BY (g_cs_orphans) ;
517
517
518
518
Peer (NodeId id) : m_id(id) {}
519
519
};
@@ -3876,9 +3876,11 @@ bool PeerManager::ProcessMessages(CNode* pfrom, std::atomic<bool>& interruptMsgP
3876
3876
if (!pfrom->vRecvGetData .empty ())
3877
3877
ProcessGetData (*pfrom, m_chainparams, m_connman, m_mempool, interruptMsgProc);
3878
3878
3879
- if (!peer-> m_orphan_work_set . empty ()) {
3879
+ {
3880
3880
LOCK2 (cs_main, g_cs_orphans);
3881
- ProcessOrphanTx (peer->m_orphan_work_set );
3881
+ if (!peer->m_orphan_work_set .empty ()) {
3882
+ ProcessOrphanTx (peer->m_orphan_work_set );
3883
+ }
3882
3884
}
3883
3885
3884
3886
if (pfrom->fDisconnect )
@@ -3887,7 +3889,10 @@ bool PeerManager::ProcessMessages(CNode* pfrom, std::atomic<bool>& interruptMsgP
3887
3889
// this maintains the order of responses
3888
3890
// and prevents vRecvGetData to grow unbounded
3889
3891
if (!pfrom->vRecvGetData .empty ()) return true ;
3890
- if (!peer->m_orphan_work_set .empty ()) return true ;
3892
+ {
3893
+ LOCK (g_cs_orphans);
3894
+ if (!peer->m_orphan_work_set .empty ()) return true ;
3895
+ }
3891
3896
3892
3897
// Don't bother if send buffer is too full to respond anyway
3893
3898
if (pfrom->fPauseSend )
0 commit comments