diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -93,6 +93,7 @@ #include #include #endif +#include #include #include #include @@ -2434,15 +2435,13 @@ 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(check_ratio); + node.mempool = std::make_unique(mempool_check_ratio); node.chainman = std::make_unique(); ChainstateManager &chainman = *node.chainman;