aboutsummaryrefslogtreecommitdiff
path: root/src/test
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/test
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/test')
-rw-r--r--src/test/setup_common.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/test/setup_common.cpp b/src/test/setup_common.cpp
index 3425bd59c1..5e7da84dfb 100644
--- a/src/test/setup_common.cpp
+++ b/src/test/setup_common.cpp
@@ -102,9 +102,12 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
throw std::runtime_error(strprintf("ActivateBestChain failed. (%s)", FormatStateMessage(state)));
}
- nScriptCheckThreads = 3;
- for (int i = 0; i < nScriptCheckThreads - 1; i++)
+ // Start script-checking threads. Set g_parallel_script_checks to true so they are used.
+ constexpr int script_check_threads = 2;
+ for (int i = 0; i < script_check_threads; ++i) {
threadGroup.create_thread([i]() { return ThreadScriptCheck(i); });
+ }
+ g_parallel_script_checks = true;
m_node.banman = MakeUnique<BanMan>(GetDataDir() / "banlist.dat", nullptr, DEFAULT_MISBEHAVING_BANTIME);
m_node.connman = MakeUnique<CConnman>(0x1337, 0x1337); // Deterministic randomness for tests.