mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-18 08:32:30 +01:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user