mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-11 03:53:22 +02:00
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.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user