@@ -186,47 +186,59 @@ class CBlockPolicyEstimator
186
186
187
187
/* * Process all the transactions that have been included in a block */
188
188
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);
190
191
191
192
/* * 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);
193
195
194
196
/* * Remove a transaction from the mempool tracking stats*/
195
- bool removeTx (uint256 hash, bool inBlock);
197
+ bool removeTx (uint256 hash, bool inBlock)
198
+ EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
196
199
197
200
/* * DEPRECATED. Return a feerate estimate */
198
- CFeeRate estimateFee (int confTarget) const ;
201
+ CFeeRate estimateFee (int confTarget) const
202
+ EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
199
203
200
204
/* * Estimate feerate needed to get be included in a block within confTarget
201
205
* blocks. If no answer can be given at confTarget, return an estimate at
202
206
* the closest target where one can be given. 'conservative' estimates are
203
207
* valid over longer time horizons also.
204
208
*/
205
- CFeeRate estimateSmartFee (int confTarget, FeeCalculation *feeCalc, bool conservative) const ;
209
+ CFeeRate estimateSmartFee (int confTarget, FeeCalculation *feeCalc, bool conservative) const
210
+ EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
206
211
207
212
/* * Return a specific fee estimate calculation with a given success
208
213
* threshold and time horizon, and optionally return detailed data about
209
214
* calculation
210
215
*/
211
- CFeeRate estimateRawFee (int confTarget, double successThreshold, FeeEstimateHorizon horizon, EstimationResult *result = nullptr ) const ;
216
+ CFeeRate estimateRawFee (int confTarget, double successThreshold, FeeEstimateHorizon horizon,
217
+ EstimationResult* result = nullptr ) const
218
+ EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
212
219
213
220
/* * Write estimation data to a file */
214
- bool Write (CAutoFile& fileout) const ;
221
+ bool Write (CAutoFile& fileout) const
222
+ EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
215
223
216
224
/* * Read estimation data from a file */
217
- bool Read (CAutoFile& filein);
225
+ bool Read (CAutoFile& filein)
226
+ EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
218
227
219
228
/* * Empty mempool transactions on shutdown to record failure to confirm for txs still in mempool */
220
- void FlushUnconfirmed ();
229
+ void FlushUnconfirmed ()
230
+ EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
221
231
222
232
/* * Calculation of highest target that estimates are tracked for */
223
- unsigned int HighestTargetTracked (FeeEstimateHorizon horizon) const ;
233
+ unsigned int HighestTargetTracked (FeeEstimateHorizon horizon) const
234
+ EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
224
235
225
236
/* * Drop still unconfirmed transactions and record current estimations, if the fee estimation file is present. */
226
- void Flush ();
237
+ void Flush ()
238
+ EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
227
239
228
240
private:
229
- mutable RecursiveMutex m_cs_fee_estimator;
241
+ mutable Mutex m_cs_fee_estimator;
230
242
231
243
unsigned int nBestSeenHeight GUARDED_BY (m_cs_fee_estimator);
232
244
unsigned int firstRecordedHeight GUARDED_BY (m_cs_fee_estimator);
@@ -267,6 +279,10 @@ class CBlockPolicyEstimator
267
279
unsigned int HistoricalBlockSpan () const EXCLUSIVE_LOCKS_REQUIRED(m_cs_fee_estimator);
268
280
/* * Calculation of highest target that reasonable estimate can be provided for */
269
281
unsigned int MaxUsableEstimate () const EXCLUSIVE_LOCKS_REQUIRED(m_cs_fee_estimator);
282
+
283
+ /* * A non-thread-safe helper for the removeTx function */
284
+ bool _removeTx (const uint256& hash, bool inBlock)
285
+ EXCLUSIVE_LOCKS_REQUIRED(m_cs_fee_estimator);
270
286
};
271
287
272
288
class FeeFilterRounder
0 commit comments