diff options
author | glozow <gloriajzhao@gmail.com> | 2023-01-04 08:44:21 +0000 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2023-01-04 08:44:26 +0000 |
commit | 03254c22296a8a05f42c7faea8dde1db7be06459 (patch) | |
tree | bb1e90f2fd9516ab738664619d6ab31d4bac8865 /src/txmempool.h | |
parent | 3f8591d46b46cec2c4effc01f8822222087d74c4 (diff) | |
parent | fa818e103c0ddb515f29ae9ce8de44931e12e69e (diff) | |
download | bitcoin-03254c22296a8a05f42c7faea8dde1db7be06459.tar.xz |
Merge bitcoin/bitcoin#19909: refactor: Remove unused CTxMemPool::clear() helper
fa818e103c0ddb515f29ae9ce8de44931e12e69e txmempool: Remove unused clear() member function (MarcoFalke)
Pull request description:
Seems odd to have code in Bitcoin Core that is unused.
Moreover the function was broken (see https://github.com/bitcoin/bitcoin/pull/24145) and is brittle, as there is nothing that prevents similar bugs from re-appearing.
Fix both issues by replacing it with C++11 member initializers.
ACKs for top commit:
glozow:
ACK fa818e103c0ddb515f29ae9ce8de44931e12e69e
Tree-SHA512: e79e44cac7d5a84d9ecc8e3f3b0b9a50e1e3ebec358b20ba5dac175ef07d1fbe338a20f83ee80f746f7c726c79e77f8be49e14bca57a41063da8a5302123c3a9
Diffstat (limited to 'src/txmempool.h')
-rw-r--r-- | src/txmempool.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/txmempool.h b/src/txmempool.h index d275710cea..c3bc86cc04 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -319,14 +319,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 @@ -500,8 +500,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; |