mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Move global scriptcheckqueue into ChainstateManager class
This commit is contained in:
@@ -6,7 +6,9 @@
|
||||
|
||||
#include <arith_uint256.h>
|
||||
#include <common/args.h>
|
||||
#include <common/system.h>
|
||||
#include <kernel/chainstatemanager_opts.h>
|
||||
#include <logging.h>
|
||||
#include <node/coins_view_args.h>
|
||||
#include <node/database_args.h>
|
||||
#include <tinyformat.h>
|
||||
@@ -16,6 +18,7 @@
|
||||
#include <util/translation.h>
|
||||
#include <validation.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
@@ -41,6 +44,16 @@ util::Result<void> ApplyArgsManOptions(const ArgsManager& args, ChainstateManage
|
||||
ReadDatabaseArgs(args, opts.coins_db);
|
||||
ReadCoinsViewArgs(args, opts.coins_view);
|
||||
|
||||
int script_threads = args.GetIntArg("-par", DEFAULT_SCRIPTCHECK_THREADS);
|
||||
if (script_threads <= 0) {
|
||||
// -par=0 means autodetect (number of cores - 1 script threads)
|
||||
// -par=-n means "leave n cores free" (number of cores - n - 1 script threads)
|
||||
script_threads += GetNumCores();
|
||||
}
|
||||
// Subtract 1 because the main thread counts towards the par threads.
|
||||
opts.worker_threads_num = std::clamp(script_threads - 1, 0, MAX_SCRIPTCHECK_THREADS);
|
||||
LogPrintf("Script verification uses %d additional threads\n", opts.worker_threads_num);
|
||||
|
||||
return {};
|
||||
}
|
||||
} // namespace node
|
||||
|
||||
Reference in New Issue
Block a user