mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
Move all g_cs_orphans locking to txorphanage
This commit is contained in:
@@ -595,8 +595,8 @@ private:
|
||||
* reconsidered.
|
||||
* @return True if there are still orphans in this peer's work set.
|
||||
*/
|
||||
bool ProcessOrphanTx(Peer& peer) EXCLUSIVE_LOCKS_REQUIRED(cs_main, g_cs_orphans)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, g_msgproc_mutex);
|
||||
bool ProcessOrphanTx(Peer& peer)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, g_msgproc_mutex, cs_main);
|
||||
/** Process a single headers message from a peer.
|
||||
*
|
||||
* @param[in] pfrom CNode of the peer
|
||||
@@ -1501,7 +1501,7 @@ void PeerManagerImpl::FinalizeNode(const CNode& node)
|
||||
for (const QueuedBlock& entry : state->vBlocksInFlight) {
|
||||
mapBlocksInFlight.erase(entry.pindex->GetBlockHash());
|
||||
}
|
||||
WITH_LOCK(g_cs_orphans, m_orphanage.EraseForPeer(nodeid));
|
||||
m_orphanage.EraseForPeer(nodeid);
|
||||
m_txrequest.DisconnectedPeer(nodeid);
|
||||
m_num_preferred_download_peers -= state->fPreferredDownload;
|
||||
m_peers_downloading_from -= (state->nBlocksInFlight != 0);
|
||||
@@ -2885,7 +2885,6 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
|
||||
{
|
||||
AssertLockHeld(g_msgproc_mutex);
|
||||
AssertLockHeld(cs_main);
|
||||
AssertLockHeld(g_cs_orphans);
|
||||
|
||||
CTransactionRef porphanTx = nullptr;
|
||||
NodeId from_peer = -1;
|
||||
@@ -3903,7 +3902,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
AddKnownTx(*peer, txid);
|
||||
}
|
||||
|
||||
LOCK2(cs_main, g_cs_orphans);
|
||||
LOCK(cs_main);
|
||||
|
||||
m_txrequest.ReceivedResponse(pfrom.GetId(), txid);
|
||||
if (tx.HasWitness()) m_txrequest.ReceivedResponse(pfrom.GetId(), wtxid);
|
||||
@@ -4139,7 +4138,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
bool fBlockReconstructed = false;
|
||||
|
||||
{
|
||||
LOCK2(cs_main, g_cs_orphans);
|
||||
LOCK(cs_main);
|
||||
// If AcceptBlockHeader returned true, it set pindex
|
||||
assert(pindex);
|
||||
UpdateBlockAvailability(pfrom.GetId(), pindex->GetBlockHash());
|
||||
@@ -4769,7 +4768,7 @@ bool PeerManagerImpl::ProcessMessages(CNode* pfrom, std::atomic<bool>& interrupt
|
||||
|
||||
bool has_more_orphans;
|
||||
{
|
||||
LOCK2(cs_main, g_cs_orphans);
|
||||
LOCK(cs_main);
|
||||
has_more_orphans = ProcessOrphanTx(*peer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user