@@ -228,10 +228,12 @@ class CBlockPolicyEstimator
228
228
unsigned int HighestTargetTracked (FeeEstimateHorizon horizon) const ;
229
229
230
230
private:
231
- unsigned int nBestSeenHeight;
232
- unsigned int firstRecordedHeight;
233
- unsigned int historicalFirst;
234
- unsigned int historicalBest;
231
+ mutable CCriticalSection cs_feeEstimator;
232
+
233
+ unsigned int nBestSeenHeight GUARDED_BY (cs_feeEstimator);
234
+ unsigned int firstRecordedHeight GUARDED_BY (cs_feeEstimator);
235
+ unsigned int historicalFirst GUARDED_BY (cs_feeEstimator);
236
+ unsigned int historicalBest GUARDED_BY (cs_feeEstimator);
235
237
236
238
struct TxStatsInfo
237
239
{
@@ -241,34 +243,32 @@ class CBlockPolicyEstimator
241
243
};
242
244
243
245
// map of txids to information about that transaction
244
- std::map<uint256, TxStatsInfo> mapMemPoolTxs;
246
+ std::map<uint256, TxStatsInfo> mapMemPoolTxs GUARDED_BY (cs_feeEstimator) ;
245
247
246
248
/* * Classes to track historical data on transaction confirmations */
247
249
std::unique_ptr<TxConfirmStats> feeStats;
248
250
std::unique_ptr<TxConfirmStats> shortStats;
249
251
std::unique_ptr<TxConfirmStats> longStats;
250
252
251
- unsigned int trackedTxs;
252
- unsigned int untrackedTxs;
253
+ unsigned int trackedTxs GUARDED_BY (cs_feeEstimator) ;
254
+ unsigned int untrackedTxs GUARDED_BY (cs_feeEstimator) ;
253
255
254
- std::vector<double > buckets; // The upper-bound of the range for the bucket (inclusive)
255
- std::map<double , unsigned int > bucketMap; // Map of bucket upper-bound to index into all vectors by bucket
256
-
257
- mutable CCriticalSection cs_feeEstimator;
256
+ std::vector<double > buckets GUARDED_BY (cs_feeEstimator); // The upper-bound of the range for the bucket (inclusive)
257
+ std::map<double , unsigned int > bucketMap GUARDED_BY (cs_feeEstimator); // Map of bucket upper-bound to index into all vectors by bucket
258
258
259
259
/* * Process a transaction confirmed in a block*/
260
- bool processBlockTx (unsigned int nBlockHeight, const CTxMemPoolEntry* entry);
260
+ bool processBlockTx (unsigned int nBlockHeight, const CTxMemPoolEntry* entry) EXCLUSIVE_LOCKS_REQUIRED(cs_feeEstimator) ;
261
261
262
262
/* * Helper for estimateSmartFee */
263
- double estimateCombinedFee (unsigned int confTarget, double successThreshold, bool checkShorterHorizon, EstimationResult *result) const ;
263
+ double estimateCombinedFee (unsigned int confTarget, double successThreshold, bool checkShorterHorizon, EstimationResult *result) const EXCLUSIVE_LOCKS_REQUIRED(cs_feeEstimator) ;
264
264
/* * Helper for estimateSmartFee */
265
- double estimateConservativeFee (unsigned int doubleTarget, EstimationResult *result) const ;
265
+ double estimateConservativeFee (unsigned int doubleTarget, EstimationResult *result) const EXCLUSIVE_LOCKS_REQUIRED(cs_feeEstimator) ;
266
266
/* * Number of blocks of data recorded while fee estimates have been running */
267
- unsigned int BlockSpan () const ;
267
+ unsigned int BlockSpan () const EXCLUSIVE_LOCKS_REQUIRED(cs_feeEstimator) ;
268
268
/* * Number of blocks of recorded fee estimate data represented in saved data file */
269
- unsigned int HistoricalBlockSpan () const ;
269
+ unsigned int HistoricalBlockSpan () const EXCLUSIVE_LOCKS_REQUIRED(cs_feeEstimator) ;
270
270
/* * Calculation of highest target that reasonable estimate can be provided for */
271
- unsigned int MaxUsableEstimate () const ;
271
+ unsigned int MaxUsableEstimate () const EXCLUSIVE_LOCKS_REQUIRED(cs_feeEstimator) ;
272
272
};
273
273
274
274
class FeeFilterRounder
0 commit comments