aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorElle Mouton <elle.mouton@gmail.com>2020-10-20 20:42:47 +0200
committerElle Mouton <elle.mouton@gmail.com>2020-10-23 14:41:30 +0200
commite3310692d0e9720e960b9785274ce1f0b58b4cd7 (patch)
treeb110b230110db9e2a9616a83cb8c3b545dbdb01d /src/init.cpp
parent9d4b4b2c2c49774523de740d6492ee5b1ee15e74 (diff)
downloadbitcoin-e3310692d0e9720e960b9785274ce1f0b58b4cd7.tar.xz
refactor: Make CTxMemPool::m_check_ratio a const and a constructor argument
Since m_check_ratio is only set once and since the CTxMemPool object is no longer a global variable, m_check_ratio can be passed into the constructor of CTxMemPool. Since it is only read from after initialization, m_check_ratio can also be made a const and hence no longer needs to be guarded by the cs mutex.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 51a4943478..1ba34945c2 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1389,14 +1389,9 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA
assert(!node.connman);
node.connman = MakeUnique<CConnman>(GetRand(std::numeric_limits<uint64_t>::max()), GetRand(std::numeric_limits<uint64_t>::max()), args.GetBoolArg("-networkactive", true));
- // Make mempool generally available in the node context. For example the connection manager, wallet, or RPC threads,
- // which are all started after this, may use it from the node context.
assert(!node.mempool);
- node.mempool = MakeUnique<CTxMemPool>(&::feeEstimator);
- if (node.mempool) {
- int check_ratio = std::min<int>(std::max<int>(args.GetArg("-checkmempool", chainparams.DefaultConsistencyChecks() ? 1 : 0), 0), 1000000);
- node.mempool->setSanityCheck(check_ratio);
- }
+ int check_ratio = std::min<int>(std::max<int>(args.GetArg("-checkmempool", chainparams.DefaultConsistencyChecks() ? 1 : 0), 0), 1000000);
+ node.mempool = MakeUnique<CTxMemPool>(&::feeEstimator, check_ratio);
assert(!node.chainman);
node.chainman = &g_chainman;