@@ -473,6 +473,12 @@ void TxConfirmStats::removeTx(unsigned int entryHeight, unsigned int nBestSeenHe
473
473
bool CBlockPolicyEstimator::removeTx (uint256 hash, bool inBlock)
474
474
{
475
475
LOCK (m_cs_fee_estimator);
476
+ return _removeTx (hash, inBlock);
477
+ }
478
+
479
+ bool CBlockPolicyEstimator::_removeTx (const uint256& hash, bool inBlock)
480
+ {
481
+ AssertLockHeld (m_cs_fee_estimator);
476
482
std::map<uint256, TxStatsInfo>::iterator pos = mapMemPoolTxs.find (hash);
477
483
if (pos != mapMemPoolTxs.end ()) {
478
484
feeStats->removeTx (pos->second .blockHeight , nBestSeenHeight, pos->second .bucketIndex , inBlock);
@@ -556,7 +562,8 @@ void CBlockPolicyEstimator::processTransaction(const CTxMemPoolEntry& entry, boo
556
562
557
563
bool CBlockPolicyEstimator::processBlockTx (unsigned int nBlockHeight, const CTxMemPoolEntry* entry)
558
564
{
559
- if (!removeTx (entry->GetTx ().GetHash (), true )) {
565
+ AssertLockHeld (m_cs_fee_estimator);
566
+ if (!_removeTx (entry->GetTx ().GetHash (), true )) {
560
567
// This transaction wasn't being tracked for fee estimation
561
568
return false ;
562
569
}
@@ -965,7 +972,7 @@ void CBlockPolicyEstimator::FlushUnconfirmed() {
965
972
// Remove every entry in mapMemPoolTxs
966
973
while (!mapMemPoolTxs.empty ()) {
967
974
auto mi = mapMemPoolTxs.begin ();
968
- removeTx (mi->first , false ); // this calls erase() on mapMemPoolTxs
975
+ _removeTx (mi->first , false ); // this calls erase() on mapMemPoolTxs
969
976
}
970
977
int64_t endclear = GetTimeMicros ();
971
978
LogPrint (BCLog::ESTIMATEFEE, " Recorded %u unconfirmed txs from mempool in %gs\n " , num_entries, (endclear - startclear)*0.000001 );
0 commit comments