Skip to content

Commit

Permalink
Tweak logic to align better with negative values
Browse files Browse the repository at this point in the history
  • Loading branch information
prasannavl committed Feb 20, 2023
1 parent 7a77a76 commit 33df70d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1473,13 +1473,14 @@ bool AppInitMain(InitInterfaces& interfaces)

int script_threads = gArgs.GetArg("-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();
// DeFiChain specific:
// Set this to a max value, since most custom TXs don't utilize this unfortunately
// and is just a waste of resources.
script_threads = std::min(script_threads, 4);
// and is just a waste of resources.
auto defaultThreads = std::min(script_threads, 4);

// -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 += defaultThreads;
}

// Subtract 1 because the main thread counts towards the par threads
Expand Down

0 comments on commit 33df70d

Please sign in to comment.