Skip to content

Commit

Permalink
refactor: Clean up CTxMemPool initializer list
Browse files Browse the repository at this point in the history
Summary:
Shorten the CTxMemPool initializer list using default initialization
for members that dont depend on the constuctor parameters.

This is a backport of [[bitcoin/bitcoin#20222 | core#20222]] [3/3]
bitcoin/bitcoin@f15e780

Depends on D10842

Test Plan:
`ninja all check-all`

eviewers:

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10843
  • Loading branch information
ellemouton authored and PiRK committed Jan 19, 2022
1 parent ae6af22 commit f62674e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,7 @@ void CTxMemPoolEntry::UpdateAncestorState(int64_t modifySize, Amount modifyFee,
assert(int(nSigOpCountWithAncestors) >= 0);
}

CTxMemPool::CTxMemPool(int check_ratio)
: m_check_ratio(check_ratio), nTransactionsUpdated(0), m_epoch(0),
m_has_epoch_guard(false) {
CTxMemPool::CTxMemPool(int check_ratio) : m_check_ratio(check_ratio) {
// lock free clear
_clear();
}
Expand Down
6 changes: 3 additions & 3 deletions src/txmempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ class CTxMemPool {
//! Value n means that 1 times in n we check.
const int m_check_ratio;
//! Used by getblocktemplate to trigger CreateNewBlock() invocation
std::atomic<uint32_t> nTransactionsUpdated;
std::atomic<uint32_t> nTransactionsUpdated{0};

//! sum of all mempool tx's sizes.
uint64_t totalTxSize;
Expand All @@ -509,8 +509,8 @@ class CTxMemPool {
mutable bool blockSinceLastRollingFeeBump;
//! minimum fee to get into the pool, decreases exponentially
mutable double rollingMinimumFeeRate;
mutable uint64_t m_epoch;
mutable bool m_has_epoch_guard;
mutable uint64_t m_epoch{0};
mutable bool m_has_epoch_guard{false};

// In-memory counter for external mempool tracking purposes.
// This number is incremented once every time a transaction
Expand Down

0 comments on commit f62674e

Please sign in to comment.