aboutsummaryrefslogtreecommitdiff
path: root/src/validation.h
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2019-11-02 17:14:38 -0400
committerJohn Newbery <john@johnnewbery.com>2019-11-06 15:04:50 -0500
commit5506ecfe7a65d5705616bc048f2f1735b89993fb (patch)
treec2c62fb409c258cdda1e944737225aeca9f256af /src/validation.h
parentd9957623b48a7c3eff0ac750d1245fabfb1843a2 (diff)
downloadbitcoin-5506ecfe7a65d5705616bc048f2f1735b89993fb.tar.xz
[refactor] Replace global int nScriptCheckThreads with bool
The global nScriptCheckThreads int is confusing and is only needed for its int-ness in AppInitMain. Move all `-par` parsing logic there and replace the int nScriptCheckThreads with a bool g_parallel_script_checks. Also tidy up logic and improve comments.
Diffstat (limited to 'src/validation.h')
-rw-r--r--src/validation.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/validation.h b/src/validation.h
index 7f9582adfd..fd846e9090 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -76,8 +76,8 @@ static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000; // 16 MiB
/** The pre-allocation chunk size for rev?????.dat files (since 0.8) */
static const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000; // 1 MiB
-/** Maximum number of script-checking threads allowed */
-static const int MAX_SCRIPTCHECK_THREADS = 16;
+/** Maximum number of dedicated script-checking threads allowed */
+static const int MAX_SCRIPTCHECK_THREADS = 15;
/** -par default (number of script-checking threads, 0 = auto) */
static const int DEFAULT_SCRIPTCHECK_THREADS = 0;
/** Number of blocks that can be requested at any given time from a single peer. */
@@ -146,7 +146,10 @@ extern std::condition_variable g_best_block_cv;
extern uint256 g_best_block;
extern std::atomic_bool fImporting;
extern std::atomic_bool fReindex;
-extern int nScriptCheckThreads;
+/** Whether there are dedicated script-checking threads running.
+ * False indicates all script checking is done on the main threadMessageHandler thread.
+ */
+extern bool g_parallel_script_checks;
extern bool fRequireStandard;
extern bool fCheckBlockIndex;
extern bool fCheckpointsEnabled;