Skip to content

Commit

Permalink
Remove g_parallel_script_checks global variable
Browse files Browse the repository at this point in the history
This variable is not really used by our codebase -- we always use the
CCheckQueue, even if no parallel threads are specified (in that case we
use it with the foreground thread).  So this variable had no meaning in
our codebase.

This undoes some of the core backport #17342
  • Loading branch information
cculianu committed Jun 7, 2021
1 parent 0e94c77 commit ae2c2fb
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/bench/checkqueue.cpp
Expand Up @@ -41,7 +41,7 @@ static void CCheckQueueSpeedPrevectorJob(benchmark::State &state) {
void swap(PrevectorJob &x) { p.swap(x.p); };
};
CCheckQueue<PrevectorJob> queue{QUEUE_BATCH_SIZE};
queue.StartWorkerThreads(std::max(MIN_CORES, GetNumCores()));
queue.StartWorkerThreads(std::max(MIN_CORES, GetNumCores()) - 1);
while (state.KeepRunning()) {
// Make insecure_rand here so that each iteration is identical.
FastRandomContext insecure_rand(true);
Expand Down
1 change: 0 additions & 1 deletion src/init.cpp
Expand Up @@ -2105,7 +2105,6 @@ bool AppInitMain(Config &config, RPCServer &rpcServer,

LogPrintf("Script verification uses %d additional threads\n", script_threads);
if (script_threads >= 1) {
g_parallel_script_checks = true;
StartScriptCheckWorkerThreads(script_threads);
}

Expand Down
3 changes: 1 addition & 2 deletions src/test/setup_common.cpp
Expand Up @@ -122,10 +122,9 @@ TestingSetup::TestingSetup(const std::string &chainName)
}
}

// Start script-checking threads. Set g_parallel_script_checks to true so they are used.
// Start script-checking threads
constexpr int script_check_threads = 2;
StartScriptCheckWorkerThreads(script_check_threads);
g_parallel_script_checks = true;

g_banman =
std::make_unique<BanMan>(GetDataDir() / "banlist.dat", chainparams,
Expand Down
3 changes: 1 addition & 2 deletions src/validation.cpp
Expand Up @@ -260,7 +260,6 @@ CBlockIndex *pindexBestHeader = nullptr;
Mutex g_best_block_mutex;
std::condition_variable g_best_block_cv;
uint256 g_best_block;
bool g_parallel_script_checks{false};
std::atomic_bool fImporting(false);
std::atomic_bool fReindex(false);
bool fHavePruned = false;
Expand Down Expand Up @@ -1892,7 +1891,7 @@ bool CChainState::ConnectBlock(const CBlock &block, CValidationState &state,
CBlockUndo blockundo;
blockundo.vtxundo.resize(block.vtx.size() - 1);

CCheckQueueControl<CScriptCheck> control(fScriptChecks && g_parallel_script_checks ? &scriptcheckqueue : nullptr);
CCheckQueueControl<CScriptCheck> control(fScriptChecks ? &scriptcheckqueue : nullptr);

// Add all outputs
try {
Expand Down
4 changes: 0 additions & 4 deletions src/validation.h
Expand Up @@ -207,10 +207,6 @@ extern uint256 g_best_block;
extern std::atomic_bool fImporting;
extern std::atomic_bool fReindex;
extern bool fIsBareMultisigStd;
/** 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;
Expand Down

0 comments on commit ae2c2fb

Please sign in to comment.