Skip to content

Commit 5c3033d

Browse files
committed
Add thread safety annotations to CBlockPolicyEstimator public functions
1 parent e2b55cd commit 5c3033d

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

src/policy/fees.h

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,44 +186,55 @@ class CBlockPolicyEstimator
186186

187187
/** Process all the transactions that have been included in a block */
188188
void processBlock(unsigned int nBlockHeight,
189-
std::vector<const CTxMemPoolEntry*>& entries);
189+
std::vector<const CTxMemPoolEntry*>& entries)
190+
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
190191

191192
/** Process a transaction accepted to the mempool*/
192-
void processTransaction(const CTxMemPoolEntry& entry, bool validFeeEstimate);
193+
void processTransaction(const CTxMemPoolEntry& entry, bool validFeeEstimate)
194+
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
193195

194196
/** Remove a transaction from the mempool tracking stats*/
195197
bool removeTx(uint256 hash, bool inBlock);
196198

197199
/** DEPRECATED. Return a feerate estimate */
198-
CFeeRate estimateFee(int confTarget) const;
200+
CFeeRate estimateFee(int confTarget) const
201+
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
199202

200203
/** Estimate feerate needed to get be included in a block within confTarget
201204
* blocks. If no answer can be given at confTarget, return an estimate at
202205
* the closest target where one can be given. 'conservative' estimates are
203206
* valid over longer time horizons also.
204207
*/
205-
CFeeRate estimateSmartFee(int confTarget, FeeCalculation *feeCalc, bool conservative) const;
208+
CFeeRate estimateSmartFee(int confTarget, FeeCalculation *feeCalc, bool conservative) const
209+
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
206210

207211
/** Return a specific fee estimate calculation with a given success
208212
* threshold and time horizon, and optionally return detailed data about
209213
* calculation
210214
*/
211-
CFeeRate estimateRawFee(int confTarget, double successThreshold, FeeEstimateHorizon horizon, EstimationResult *result = nullptr) const;
215+
CFeeRate estimateRawFee(int confTarget, double successThreshold, FeeEstimateHorizon horizon,
216+
EstimationResult* result = nullptr) const
217+
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
212218

213219
/** Write estimation data to a file */
214-
bool Write(CAutoFile& fileout) const;
220+
bool Write(CAutoFile& fileout) const
221+
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
215222

216223
/** Read estimation data from a file */
217-
bool Read(CAutoFile& filein);
224+
bool Read(CAutoFile& filein)
225+
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
218226

219227
/** Empty mempool transactions on shutdown to record failure to confirm for txs still in mempool */
220-
void FlushUnconfirmed();
228+
void FlushUnconfirmed()
229+
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
221230

222231
/** Calculation of highest target that estimates are tracked for */
223-
unsigned int HighestTargetTracked(FeeEstimateHorizon horizon) const;
232+
unsigned int HighestTargetTracked(FeeEstimateHorizon horizon) const
233+
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
224234

225235
/** Drop still unconfirmed transactions and record current estimations, if the fee estimation file is present. */
226-
void Flush();
236+
void Flush()
237+
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
227238

228239
private:
229240
mutable RecursiveMutex m_cs_fee_estimator;

0 commit comments

Comments
 (0)