@@ -512,6 +512,9 @@ struct Peer {
512
512
/* * Whether this peer should be disconnected and marked as discouraged (unless it has the noban permission). */
513
513
bool m_should_discourage GUARDED_BY (m_misbehavior_mutex){false };
514
514
515
+ /* * Set of txids to reconsider once their parent transactions have been accepted **/
516
+ std::set<uint256> m_orphan_work_set;
517
+
515
518
Peer (NodeId id) : m_id(id) {}
516
519
};
517
520
@@ -2363,6 +2366,8 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
2363
2366
return ;
2364
2367
}
2365
2368
2369
+ PeerRef peer = GetPeerRef (pfrom.GetId ());
2370
+ if (peer == nullptr ) return ;
2366
2371
2367
2372
if (msg_type == NetMsgType::VERSION) {
2368
2373
// Each connection can only send one version message
@@ -3052,7 +3057,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
3052
3057
auto it_by_prev = mapOrphanTransactionsByPrev.find (COutPoint (txid, i));
3053
3058
if (it_by_prev != mapOrphanTransactionsByPrev.end ()) {
3054
3059
for (const auto & elem : it_by_prev->second ) {
3055
- pfrom. m_orphan_work_set .insert (elem->first );
3060
+ peer-> m_orphan_work_set .insert (elem->first );
3056
3061
}
3057
3062
}
3058
3063
}
@@ -3069,7 +3074,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
3069
3074
}
3070
3075
3071
3076
// Recursively process any orphan transactions that depended on this one
3072
- ProcessOrphanTx (pfrom. m_orphan_work_set );
3077
+ ProcessOrphanTx (peer-> m_orphan_work_set );
3073
3078
}
3074
3079
else if (state.GetResult () == TxValidationResult::TX_MISSING_INPUTS)
3075
3080
{
@@ -3865,12 +3870,15 @@ bool PeerManager::ProcessMessages(CNode* pfrom, std::atomic<bool>& interruptMsgP
3865
3870
{
3866
3871
bool fMoreWork = false ;
3867
3872
3873
+ PeerRef peer = GetPeerRef (pfrom->GetId ());
3874
+ if (peer == nullptr ) return false ;
3875
+
3868
3876
if (!pfrom->vRecvGetData .empty ())
3869
3877
ProcessGetData (*pfrom, m_chainparams, m_connman, m_mempool, interruptMsgProc);
3870
3878
3871
- if (!pfrom ->m_orphan_work_set .empty ()) {
3879
+ if (!peer ->m_orphan_work_set .empty ()) {
3872
3880
LOCK2 (cs_main, g_cs_orphans);
3873
- ProcessOrphanTx (pfrom ->m_orphan_work_set );
3881
+ ProcessOrphanTx (peer ->m_orphan_work_set );
3874
3882
}
3875
3883
3876
3884
if (pfrom->fDisconnect )
@@ -3879,7 +3887,7 @@ bool PeerManager::ProcessMessages(CNode* pfrom, std::atomic<bool>& interruptMsgP
3879
3887
// this maintains the order of responses
3880
3888
// and prevents vRecvGetData to grow unbounded
3881
3889
if (!pfrom->vRecvGetData .empty ()) return true ;
3882
- if (!pfrom ->m_orphan_work_set .empty ()) return true ;
3890
+ if (!peer ->m_orphan_work_set .empty ()) return true ;
3883
3891
3884
3892
// Don't bother if send buffer is too full to respond anyway
3885
3893
if (pfrom->fPauseSend )
0 commit comments