aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2015-10-07 23:34:55 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2015-10-20 18:59:08 +0200
commitab1f56072a796b0ff039d6690c6ac929dbcbf243 (patch)
treebd16f4d42d3a075a41879dbaef2674a25a7442e2 /src/init.cpp
parentc6de5cc88614f587ae2d0e360536412407e02836 (diff)
Support -checkmempool=N, which runs checks on average once every N transactions
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 75c76e3258..d899a1cf98 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -836,7 +836,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
InitWarning(_("Warning: Unsupported argument -benchmark ignored, use -debug=bench."));
// Checkmempool and checkblockindex default to true in regtest mode
- mempool.setSanityCheck(GetBoolArg("-checkmempool", chainparams.DefaultConsistencyChecks()));
+ int ratio = std::min<int>(std::max<int>(GetArg("-checkmempool", chainparams.DefaultConsistencyChecks() ? 1 : 0), 0), 1000000);
+ if (ratio != 0) {
+ mempool.setSanityCheck(1.0 / ratio);
+ }
fCheckBlockIndex = GetBoolArg("-checkblockindex", chainparams.DefaultConsistencyChecks());
fCheckpointsEnabled = GetBoolArg("-checkpoints", true);