diff options
author | Elle Mouton <elle.mouton@gmail.com> | 2020-10-20 20:09:55 +0200 |
---|---|---|
committer | Elle Mouton <elle.mouton@gmail.com> | 2020-10-23 14:14:57 +0200 |
commit | 9d4b4b2c2c49774523de740d6492ee5b1ee15e74 (patch) | |
tree | 017771d3a7b54af87ceccc1003234f3b940f889d /src/init.cpp | |
parent | 88271184e82222f556d67511cc64230b0532f40d (diff) |
refactor: Avoid double to int cast for nCheckFrequency
Use a ratio instead of a frequency that requires a double to int cast
for determining how often a mempool sanity check should run.
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/init.cpp b/src/init.cpp index 1387d6b982..51a4943478 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1394,10 +1394,8 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA assert(!node.mempool); node.mempool = MakeUnique<CTxMemPool>(&::feeEstimator); if (node.mempool) { - int ratio = std::min<int>(std::max<int>(args.GetArg("-checkmempool", chainparams.DefaultConsistencyChecks() ? 1 : 0), 0), 1000000); - if (ratio != 0) { - node.mempool->setSanityCheck(1.0 / ratio); - } + int check_ratio = std::min<int>(std::max<int>(args.GetArg("-checkmempool", chainparams.DefaultConsistencyChecks() ? 1 : 0), 0), 1000000); + node.mempool->setSanityCheck(check_ratio); } assert(!node.chainman); |