@@ -440,7 +440,7 @@ class SaltedTxidHasher
440
440
class CTxMemPool
441
441
{
442
442
private:
443
- uint32_t nCheckFrequency; // !< Value n means that n times in 2^32 we check.
443
+ uint32_t nCheckFrequency GUARDED_BY (cs) ; // !< Value n means that n times in 2^32 we check.
444
444
unsigned int nTransactionsUpdated; // !< Used by getblocktemplate to trigger CreateNewBlock() invocation
445
445
CBlockPolicyEstimator* minerPolicyEstimator;
446
446
@@ -484,7 +484,7 @@ class CTxMemPool
484
484
> indexed_transaction_set;
485
485
486
486
mutable CCriticalSection cs;
487
- indexed_transaction_set mapTx;
487
+ indexed_transaction_set mapTx GUARDED_BY (cs) ;
488
488
489
489
typedef indexed_transaction_set::nth_index<0 >::type::iterator txiter;
490
490
std::vector<std::pair<uint256, txiter> > vTxHashes; // !< All tx witness hashes/entries in mapTx, in random order
@@ -496,8 +496,8 @@ class CTxMemPool
496
496
};
497
497
typedef std::set<txiter, CompareIteratorByHash> setEntries;
498
498
499
- const setEntries & GetMemPoolParents (txiter entry) const ;
500
- const setEntries & GetMemPoolChildren (txiter entry) const ;
499
+ const setEntries & GetMemPoolParents (txiter entry) const EXCLUSIVE_LOCKS_REQUIRED(cs) ;
500
+ const setEntries & GetMemPoolChildren (txiter entry) const EXCLUSIVE_LOCKS_REQUIRED(cs) ;
501
501
private:
502
502
typedef std::map<txiter, setEntries, CompareIteratorByHash> cacheMap;
503
503
@@ -515,7 +515,7 @@ class CTxMemPool
515
515
std::vector<indexed_transaction_set::const_iterator> GetSortedDepthAndScore () const EXCLUSIVE_LOCKS_REQUIRED(cs);
516
516
517
517
public:
518
- indirectmap<COutPoint, const CTransaction*> mapNextTx;
518
+ indirectmap<COutPoint, const CTransaction*> mapNextTx GUARDED_BY (cs) ;
519
519
std::map<uint256, CAmount> mapDeltas;
520
520
521
521
/* * Create a new CTxMemPool.
@@ -529,7 +529,7 @@ class CTxMemPool
529
529
* check does nothing.
530
530
*/
531
531
void check (const CCoinsViewCache *pcoins) const ;
532
- void setSanityCheck (double dFrequency = 1.0 ) { nCheckFrequency = static_cast <uint32_t >(dFrequency * 4294967295.0 ); }
532
+ void setSanityCheck (double dFrequency = 1.0 ) { LOCK (cs); nCheckFrequency = static_cast <uint32_t >(dFrequency * 4294967295.0 ); }
533
533
534
534
// addUnchecked must updated state for all ancestors of a given transaction,
535
535
// to track size/count of descendant transactions. First version of
@@ -547,7 +547,7 @@ class CTxMemPool
547
547
void removeForBlock (const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight);
548
548
549
549
void clear ();
550
- void _clear (); // lock free
550
+ void _clear () EXCLUSIVE_LOCKS_REQUIRED(cs) ; // lock free
551
551
bool CompareDepthAndScore (const uint256& hasha, const uint256& hashb);
552
552
void queryHashes (std::vector<uint256>& vtxid);
553
553
bool isSpent (const COutPoint& outpoint) const ;
@@ -600,7 +600,7 @@ class CTxMemPool
600
600
/* * Populate setDescendants with all in-mempool descendants of hash.
601
601
* Assumes that setDescendants includes all in-mempool descendants of anything
602
602
* already in it. */
603
- void CalculateDescendants (txiter it, setEntries& setDescendants) const ;
603
+ void CalculateDescendants (txiter it, setEntries& setDescendants) const EXCLUSIVE_LOCKS_REQUIRED(cs) ;
604
604
605
605
/* * The minimum fee to get into the mempool, which may itself not be enough
606
606
* for larger-sized transactions.
@@ -665,17 +665,17 @@ class CTxMemPool
665
665
*/
666
666
void UpdateForDescendants (txiter updateIt,
667
667
cacheMap &cachedDescendants,
668
- const std::set<uint256> &setExclude);
668
+ const std::set<uint256> &setExclude) EXCLUSIVE_LOCKS_REQUIRED(cs) ;
669
669
/* * Update ancestors of hash to add/remove it as a descendant transaction. */
670
- void UpdateAncestorsOf (bool add, txiter hash, setEntries &setAncestors);
670
+ void UpdateAncestorsOf (bool add, txiter hash, setEntries &setAncestors) EXCLUSIVE_LOCKS_REQUIRED(cs) ;
671
671
/* * Set ancestor state for an entry */
672
- void UpdateEntryForAncestors (txiter it, const setEntries &setAncestors);
672
+ void UpdateEntryForAncestors (txiter it, const setEntries &setAncestors) EXCLUSIVE_LOCKS_REQUIRED(cs) ;
673
673
/* * For each transaction being removed, update ancestors and any direct children.
674
674
* If updateDescendants is true, then also update in-mempool descendants'
675
675
* ancestor state. */
676
- void UpdateForRemoveFromMempool (const setEntries &entriesToRemove, bool updateDescendants);
676
+ void UpdateForRemoveFromMempool (const setEntries &entriesToRemove, bool updateDescendants) EXCLUSIVE_LOCKS_REQUIRED(cs) ;
677
677
/* * Sever link between specified transaction and direct children. */
678
- void UpdateChildrenForRemoval (txiter entry);
678
+ void UpdateChildrenForRemoval (txiter entry) EXCLUSIVE_LOCKS_REQUIRED(cs) ;
679
679
680
680
/* * Before calling removeUnchecked for a given transaction,
681
681
* UpdateForRemoveFromMempool must be called on the entire (dependent) set
@@ -685,7 +685,7 @@ class CTxMemPool
685
685
* transactions in a chain before we've updated all the state for the
686
686
* removal.
687
687
*/
688
- void removeUnchecked (txiter entry, MemPoolRemovalReason reason = MemPoolRemovalReason::UNKNOWN);
688
+ void removeUnchecked (txiter entry, MemPoolRemovalReason reason = MemPoolRemovalReason::UNKNOWN) EXCLUSIVE_LOCKS_REQUIRED(cs) ;
689
689
};
690
690
691
691
/* *
0 commit comments