mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 04:12:36 -03:00
txmempool: Remove unused clear() member function
This commit is contained in:
parent
6061eb6564
commit
fa818e103c
3 changed files with 13 additions and 32 deletions
|
@ -77,7 +77,9 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, Dersig100Setup)
|
|||
LOCK(cs_main);
|
||||
BOOST_CHECK(m_node.chainman->ActiveChain().Tip()->GetBlockHash() != block.GetHash());
|
||||
}
|
||||
m_node.mempool->clear();
|
||||
BOOST_CHECK_EQUAL(m_node.mempool->size(), 1U);
|
||||
WITH_LOCK(m_node.mempool->cs, m_node.mempool->removeRecursive(CTransaction{spends[0]}, MemPoolRemovalReason::CONFLICT));
|
||||
BOOST_CHECK_EQUAL(m_node.mempool->size(), 0U);
|
||||
|
||||
// Test 3: ... and should be rejected if spend2 is in the memory pool
|
||||
BOOST_CHECK(ToMemPool(spends[1]));
|
||||
|
@ -86,7 +88,9 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, Dersig100Setup)
|
|||
LOCK(cs_main);
|
||||
BOOST_CHECK(m_node.chainman->ActiveChain().Tip()->GetBlockHash() != block.GetHash());
|
||||
}
|
||||
m_node.mempool->clear();
|
||||
BOOST_CHECK_EQUAL(m_node.mempool->size(), 1U);
|
||||
WITH_LOCK(m_node.mempool->cs, m_node.mempool->removeRecursive(CTransaction{spends[1]}, MemPoolRemovalReason::CONFLICT));
|
||||
BOOST_CHECK_EQUAL(m_node.mempool->size(), 0U);
|
||||
|
||||
// Final sanity test: first spend in *m_node.mempool, second in block, that's OK:
|
||||
std::vector<CMutableTransaction> oneSpend;
|
||||
|
|
|
@ -389,7 +389,6 @@ CTxMemPool::CTxMemPool(const Options& opts)
|
|||
m_full_rbf{opts.full_rbf},
|
||||
m_limits{opts.limits}
|
||||
{
|
||||
_clear(); //lock free clear
|
||||
}
|
||||
|
||||
bool CTxMemPool::isSpent(const COutPoint& outpoint) const
|
||||
|
@ -627,26 +626,6 @@ void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigne
|
|||
blockSinceLastRollingFeeBump = true;
|
||||
}
|
||||
|
||||
void CTxMemPool::_clear()
|
||||
{
|
||||
vTxHashes.clear();
|
||||
mapTx.clear();
|
||||
mapNextTx.clear();
|
||||
totalTxSize = 0;
|
||||
m_total_fee = 0;
|
||||
cachedInnerUsage = 0;
|
||||
lastRollingFeeUpdate = GetTime();
|
||||
blockSinceLastRollingFeeBump = false;
|
||||
rollingMinimumFeeRate = 0;
|
||||
++nTransactionsUpdated;
|
||||
}
|
||||
|
||||
void CTxMemPool::clear()
|
||||
{
|
||||
LOCK(cs);
|
||||
_clear();
|
||||
}
|
||||
|
||||
void CTxMemPool::check(const CCoinsViewCache& active_coins_tip, int64_t spendheight) const
|
||||
{
|
||||
if (m_check_ratio == 0) return;
|
||||
|
|
|
@ -317,14 +317,14 @@ protected:
|
|||
std::atomic<unsigned int> nTransactionsUpdated{0}; //!< Used by getblocktemplate to trigger CreateNewBlock() invocation
|
||||
CBlockPolicyEstimator* const minerPolicyEstimator;
|
||||
|
||||
uint64_t totalTxSize GUARDED_BY(cs); //!< sum of all mempool tx's virtual sizes. Differs from serialized tx size since witness data is discounted. Defined in BIP 141.
|
||||
CAmount m_total_fee GUARDED_BY(cs); //!< sum of all mempool tx's fees (NOT modified fee)
|
||||
uint64_t cachedInnerUsage GUARDED_BY(cs); //!< sum of dynamic memory usage of all the map elements (NOT the maps themselves)
|
||||
uint64_t totalTxSize GUARDED_BY(cs){0}; //!< sum of all mempool tx's virtual sizes. Differs from serialized tx size since witness data is discounted. Defined in BIP 141.
|
||||
CAmount m_total_fee GUARDED_BY(cs){0}; //!< sum of all mempool tx's fees (NOT modified fee)
|
||||
uint64_t cachedInnerUsage GUARDED_BY(cs){0}; //!< sum of dynamic memory usage of all the map elements (NOT the maps themselves)
|
||||
|
||||
mutable int64_t lastRollingFeeUpdate GUARDED_BY(cs);
|
||||
mutable bool blockSinceLastRollingFeeBump GUARDED_BY(cs);
|
||||
mutable double rollingMinimumFeeRate GUARDED_BY(cs); //!< minimum fee to get into the pool, decreases exponentially
|
||||
mutable Epoch m_epoch GUARDED_BY(cs);
|
||||
mutable int64_t lastRollingFeeUpdate GUARDED_BY(cs){GetTime()};
|
||||
mutable bool blockSinceLastRollingFeeBump GUARDED_BY(cs){false};
|
||||
mutable double rollingMinimumFeeRate GUARDED_BY(cs){0}; //!< minimum fee to get into the pool, decreases exponentially
|
||||
mutable Epoch m_epoch GUARDED_BY(cs){};
|
||||
|
||||
// In-memory counter for external mempool tracking purposes.
|
||||
// This number is incremented once every time a transaction
|
||||
|
@ -502,8 +502,6 @@ public:
|
|||
void removeConflicts(const CTransaction& tx) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
void removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
void clear();
|
||||
void _clear() EXCLUSIVE_LOCKS_REQUIRED(cs); //lock free
|
||||
bool CompareDepthAndScore(const uint256& hasha, const uint256& hashb, bool wtxid=false);
|
||||
void queryHashes(std::vector<uint256>& vtxid) const;
|
||||
bool isSpent(const COutPoint& outpoint) const;
|
||||
|
|
Loading…
Reference in a new issue