diff --git a/src/init.cpp b/src/init.cpp index 6ea25bc36d..fdcb2b8ac7 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -73,6 +73,7 @@ #include #include +#include #include #include #include @@ -1418,10 +1419,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) assert(!node.mempool); assert(!node.chainman); - int check_ratio = std::min(std::max(args.GetIntArg("-checkmempool", chainparams.DefaultConsistencyChecks() ? 1 : 0), 0), 1000000); + const int mempool_check_ratio = std::clamp(args.GetIntArg("-checkmempool", chainparams.DefaultConsistencyChecks() ? 1 : 0), 0, 1000000); for (bool fLoaded = false; !fLoaded && !ShutdownRequested();) { - node.mempool = std::make_unique(node.fee_estimator.get(), check_ratio); + node.mempool = std::make_unique(node.fee_estimator.get(), mempool_check_ratio); node.chainman = std::make_unique(); ChainstateManager& chainman = *node.chainman;