0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-05 14:06:27 -05:00

Add thread safety annotations to CBlockPolicyEstimator public functions

This commit is contained in:
Hennadii Stepanov 2021-05-21 10:15:52 +03:00
parent e2b55cd201
commit 5c3033d45e
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -186,44 +186,55 @@ public:
/** Process all the transactions that have been included in a block */ /** Process all the transactions that have been included in a block */
void processBlock(unsigned int nBlockHeight, void processBlock(unsigned int nBlockHeight,
std::vector<const CTxMemPoolEntry*>& entries); std::vector<const CTxMemPoolEntry*>& entries)
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
/** Process a transaction accepted to the mempool*/ /** Process a transaction accepted to the mempool*/
void processTransaction(const CTxMemPoolEntry& entry, bool validFeeEstimate); void processTransaction(const CTxMemPoolEntry& entry, bool validFeeEstimate)
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
/** Remove a transaction from the mempool tracking stats*/ /** Remove a transaction from the mempool tracking stats*/
bool removeTx(uint256 hash, bool inBlock); bool removeTx(uint256 hash, bool inBlock);
/** DEPRECATED. Return a feerate estimate */ /** DEPRECATED. Return a feerate estimate */
CFeeRate estimateFee(int confTarget) const; CFeeRate estimateFee(int confTarget) const
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
/** Estimate feerate needed to get be included in a block within confTarget /** Estimate feerate needed to get be included in a block within confTarget
* blocks. If no answer can be given at confTarget, return an estimate at * blocks. If no answer can be given at confTarget, return an estimate at
* the closest target where one can be given. 'conservative' estimates are * the closest target where one can be given. 'conservative' estimates are
* valid over longer time horizons also. * valid over longer time horizons also.
*/ */
CFeeRate estimateSmartFee(int confTarget, FeeCalculation *feeCalc, bool conservative) const; CFeeRate estimateSmartFee(int confTarget, FeeCalculation *feeCalc, bool conservative) const
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
/** Return a specific fee estimate calculation with a given success /** Return a specific fee estimate calculation with a given success
* threshold and time horizon, and optionally return detailed data about * threshold and time horizon, and optionally return detailed data about
* calculation * calculation
*/ */
CFeeRate estimateRawFee(int confTarget, double successThreshold, FeeEstimateHorizon horizon, EstimationResult *result = nullptr) const; CFeeRate estimateRawFee(int confTarget, double successThreshold, FeeEstimateHorizon horizon,
EstimationResult* result = nullptr) const
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
/** Write estimation data to a file */ /** Write estimation data to a file */
bool Write(CAutoFile& fileout) const; bool Write(CAutoFile& fileout) const
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
/** Read estimation data from a file */ /** Read estimation data from a file */
bool Read(CAutoFile& filein); bool Read(CAutoFile& filein)
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
/** Empty mempool transactions on shutdown to record failure to confirm for txs still in mempool */ /** Empty mempool transactions on shutdown to record failure to confirm for txs still in mempool */
void FlushUnconfirmed(); void FlushUnconfirmed()
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
/** Calculation of highest target that estimates are tracked for */ /** Calculation of highest target that estimates are tracked for */
unsigned int HighestTargetTracked(FeeEstimateHorizon horizon) const; unsigned int HighestTargetTracked(FeeEstimateHorizon horizon) const
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
/** Drop still unconfirmed transactions and record current estimations, if the fee estimation file is present. */ /** Drop still unconfirmed transactions and record current estimations, if the fee estimation file is present. */
void Flush(); void Flush()
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
private: private:
mutable RecursiveMutex m_cs_fee_estimator; mutable RecursiveMutex m_cs_fee_estimator;