mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-19 16:53:01 +02:00
net_processing: move extra transactions to msgproc mutex
Previously vExtraTxnForCompact and vExtraTxnForCompactIt were protected by g_cs_orphans; protect them by g_msgproc_mutex instead, as they are only used during message processing.
This commit is contained in:
@ -590,7 +590,7 @@ private:
|
|||||||
bool MaybeDiscourageAndDisconnect(CNode& pnode, Peer& peer);
|
bool MaybeDiscourageAndDisconnect(CNode& pnode, Peer& peer);
|
||||||
|
|
||||||
void ProcessOrphanTx(std::set<uint256>& orphan_work_set) EXCLUSIVE_LOCKS_REQUIRED(cs_main, g_cs_orphans)
|
void ProcessOrphanTx(std::set<uint256>& orphan_work_set) EXCLUSIVE_LOCKS_REQUIRED(cs_main, g_cs_orphans)
|
||||||
EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
|
EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, g_msgproc_mutex);
|
||||||
/** Process a single headers message from a peer.
|
/** Process a single headers message from a peer.
|
||||||
*
|
*
|
||||||
* @param[in] pfrom CNode of the peer
|
* @param[in] pfrom CNode of the peer
|
||||||
@ -924,14 +924,14 @@ private:
|
|||||||
/** Storage for orphan information */
|
/** Storage for orphan information */
|
||||||
TxOrphanage m_orphanage;
|
TxOrphanage m_orphanage;
|
||||||
|
|
||||||
void AddToCompactExtraTransactions(const CTransactionRef& tx) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
|
void AddToCompactExtraTransactions(const CTransactionRef& tx) EXCLUSIVE_LOCKS_REQUIRED(g_msgproc_mutex);
|
||||||
|
|
||||||
/** Orphan/conflicted/etc transactions that are kept for compact block reconstruction.
|
/** Orphan/conflicted/etc transactions that are kept for compact block reconstruction.
|
||||||
* The last -blockreconstructionextratxn/DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN of
|
* The last -blockreconstructionextratxn/DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN of
|
||||||
* these are kept in a ring buffer */
|
* these are kept in a ring buffer */
|
||||||
std::vector<std::pair<uint256, CTransactionRef>> vExtraTxnForCompact GUARDED_BY(g_cs_orphans);
|
std::vector<std::pair<uint256, CTransactionRef>> vExtraTxnForCompact GUARDED_BY(g_msgproc_mutex);
|
||||||
/** Offset into vExtraTxnForCompact to insert the next tx */
|
/** Offset into vExtraTxnForCompact to insert the next tx */
|
||||||
size_t vExtraTxnForCompactIt GUARDED_BY(g_cs_orphans) = 0;
|
size_t vExtraTxnForCompactIt GUARDED_BY(g_msgproc_mutex) = 0;
|
||||||
|
|
||||||
/** Check whether the last unknown block a peer advertised is not yet known. */
|
/** Check whether the last unknown block a peer advertised is not yet known. */
|
||||||
void ProcessBlockAvailability(NodeId nodeid) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
void ProcessBlockAvailability(NodeId nodeid) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||||
@ -2885,6 +2885,7 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, Peer& peer,
|
|||||||
*/
|
*/
|
||||||
void PeerManagerImpl::ProcessOrphanTx(std::set<uint256>& orphan_work_set)
|
void PeerManagerImpl::ProcessOrphanTx(std::set<uint256>& orphan_work_set)
|
||||||
{
|
{
|
||||||
|
AssertLockHeld(g_msgproc_mutex);
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
AssertLockHeld(g_cs_orphans);
|
AssertLockHeld(g_cs_orphans);
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <primitives/transaction.h>
|
#include <primitives/transaction.h>
|
||||||
#include <sync.h>
|
#include <sync.h>
|
||||||
|
|
||||||
/** Guards orphan transactions and extra txs for compact blocks */
|
/** Guards orphan transactions */
|
||||||
extern RecursiveMutex g_cs_orphans;
|
extern RecursiveMutex g_cs_orphans;
|
||||||
|
|
||||||
/** A class to track orphan transactions (failed on TX_MISSING_INPUTS)
|
/** A class to track orphan transactions (failed on TX_MISSING_INPUTS)
|
||||||
|
Reference in New Issue
Block a user