policy: Add Clang thread safety annotations for variables guarded by cs_feeEstimator

This commit is contained in:
practicalswift 2018-10-08 15:17:18 +02:00
parent ed12fd83ca
commit 9a789d4dc6

View file

@ -228,10 +228,12 @@ public:
unsigned int HighestTargetTracked(FeeEstimateHorizon horizon) const; unsigned int HighestTargetTracked(FeeEstimateHorizon horizon) const;
private: private:
unsigned int nBestSeenHeight; mutable CCriticalSection cs_feeEstimator;
unsigned int firstRecordedHeight;
unsigned int historicalFirst; unsigned int nBestSeenHeight GUARDED_BY(cs_feeEstimator);
unsigned int historicalBest; unsigned int firstRecordedHeight GUARDED_BY(cs_feeEstimator);
unsigned int historicalFirst GUARDED_BY(cs_feeEstimator);
unsigned int historicalBest GUARDED_BY(cs_feeEstimator);
struct TxStatsInfo struct TxStatsInfo
{ {
@ -241,34 +243,32 @@ private:
}; };
// map of txids to information about that transaction // map of txids to information about that transaction
std::map<uint256, TxStatsInfo> mapMemPoolTxs; std::map<uint256, TxStatsInfo> mapMemPoolTxs GUARDED_BY(cs_feeEstimator);
/** Classes to track historical data on transaction confirmations */ /** Classes to track historical data on transaction confirmations */
std::unique_ptr<TxConfirmStats> feeStats; std::unique_ptr<TxConfirmStats> feeStats;
std::unique_ptr<TxConfirmStats> shortStats; std::unique_ptr<TxConfirmStats> shortStats;
std::unique_ptr<TxConfirmStats> longStats; std::unique_ptr<TxConfirmStats> longStats;
unsigned int trackedTxs; unsigned int trackedTxs GUARDED_BY(cs_feeEstimator);
unsigned int untrackedTxs; unsigned int untrackedTxs GUARDED_BY(cs_feeEstimator);
std::vector<double> buckets; // The upper-bound of the range for the bucket (inclusive) std::vector<double> buckets GUARDED_BY(cs_feeEstimator); // The upper-bound of the range for the bucket (inclusive)
std::map<double, unsigned int> bucketMap; // Map of bucket upper-bound to index into all vectors by bucket std::map<double, unsigned int> bucketMap GUARDED_BY(cs_feeEstimator); // Map of bucket upper-bound to index into all vectors by bucket
mutable CCriticalSection cs_feeEstimator;
/** Process a transaction confirmed in a block*/ /** Process a transaction confirmed in a block*/
bool processBlockTx(unsigned int nBlockHeight, const CTxMemPoolEntry* entry); bool processBlockTx(unsigned int nBlockHeight, const CTxMemPoolEntry* entry) EXCLUSIVE_LOCKS_REQUIRED(cs_feeEstimator);
/** Helper for estimateSmartFee */ /** Helper for estimateSmartFee */
double estimateCombinedFee(unsigned int confTarget, double successThreshold, bool checkShorterHorizon, EstimationResult *result) const; double estimateCombinedFee(unsigned int confTarget, double successThreshold, bool checkShorterHorizon, EstimationResult *result) const EXCLUSIVE_LOCKS_REQUIRED(cs_feeEstimator);
/** Helper for estimateSmartFee */ /** Helper for estimateSmartFee */
double estimateConservativeFee(unsigned int doubleTarget, EstimationResult *result) const; double estimateConservativeFee(unsigned int doubleTarget, EstimationResult *result) const EXCLUSIVE_LOCKS_REQUIRED(cs_feeEstimator);
/** Number of blocks of data recorded while fee estimates have been running */ /** Number of blocks of data recorded while fee estimates have been running */
unsigned int BlockSpan() const; unsigned int BlockSpan() const EXCLUSIVE_LOCKS_REQUIRED(cs_feeEstimator);
/** Number of blocks of recorded fee estimate data represented in saved data file */ /** Number of blocks of recorded fee estimate data represented in saved data file */
unsigned int HistoricalBlockSpan() const; unsigned int HistoricalBlockSpan() const EXCLUSIVE_LOCKS_REQUIRED(cs_feeEstimator);
/** Calculation of highest target that reasonable estimate can be provided for */ /** Calculation of highest target that reasonable estimate can be provided for */
unsigned int MaxUsableEstimate() const; unsigned int MaxUsableEstimate() const EXCLUSIVE_LOCKS_REQUIRED(cs_feeEstimator);
}; };
class FeeFilterRounder class FeeFilterRounder