@@ -37,14 +37,17 @@ static const char* SettingName(OptionsModel::OptionID option)
37
37
{
38
38
switch (option) {
39
39
case OptionsModel::DatabaseCache: return " dbcache" ;
40
+ case OptionsModel::ThreadsScriptVerif: return " par" ;
40
41
default : throw std::logic_error (strprintf (" GUI option %i has no corresponding node setting." , option));
41
42
}
42
43
}
43
44
44
45
/* * Call node.updateRwSetting() with Bitcoin 22.x workaround. */
45
46
static void UpdateRwSetting (interfaces::Node& node, OptionsModel::OptionID option, const util::SettingsValue& value)
46
47
{
47
- if (value.isNum () && option == OptionsModel::DatabaseCache) {
48
+ if (value.isNum () &&
49
+ (option == OptionsModel::DatabaseCache ||
50
+ option == OptionsModel::ThreadsScriptVerif)) {
48
51
// Write certain old settings as strings, even though they are numbers,
49
52
// because Bitcoin 22.x releases try to read these specific settings as
50
53
// strings in addOverriddenOption() calls at startup, triggering
@@ -122,7 +125,7 @@ bool OptionsModel::Init(bilingual_str& error)
122
125
123
126
// These are shared with the core or have a command-line parameter
124
127
// and we want command-line parameters to overwrite the GUI settings.
125
- for (OptionID option : {DatabaseCache}) {
128
+ for (OptionID option : {DatabaseCache, ThreadsScriptVerif }) {
126
129
std::string setting = SettingName (option);
127
130
if (node ().isSettingIgnored (setting)) addOverriddenOption (" -" + setting);
128
131
try {
@@ -147,12 +150,6 @@ bool OptionsModel::Init(bilingual_str& error)
147
150
if (!settings.contains (" nPruneSize" ))
148
151
settings.setValue (" nPruneSize" , DEFAULT_PRUNE_TARGET_GB);
149
152
SetPruneEnabled (settings.value (" bPrune" ).toBool ());
150
-
151
- if (!settings.contains (" nThreadsScriptVerif" ))
152
- settings.setValue (" nThreadsScriptVerif" , DEFAULT_SCRIPTCHECK_THREADS);
153
- if (!gArgs .SoftSetArg (" -par" , settings.value (" nThreadsScriptVerif" ).toString ().toStdString ()))
154
- addOverriddenOption (" -par" );
155
-
156
153
if (!settings.contains (" strDataDir" ))
157
154
settings.setValue (" strDataDir" , GUIUtil::getDefaultDataDirectory ());
158
155
@@ -458,7 +455,7 @@ QVariant OptionsModel::getOption(OptionID option) const
458
455
case DatabaseCache:
459
456
return qlonglong (SettingToInt (setting (), nDefaultDbCache));
460
457
case ThreadsScriptVerif:
461
- return settings. value ( " nThreadsScriptVerif " );
458
+ return qlonglong ( SettingToInt ( setting (), DEFAULT_SCRIPTCHECK_THREADS) );
462
459
case Listen:
463
460
return settings.value (" fListen" );
464
461
case Server:
@@ -619,8 +616,8 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value)
619
616
}
620
617
break ;
621
618
case ThreadsScriptVerif:
622
- if (settings. value ( " nThreadsScriptVerif " ) != value ) {
623
- settings. setValue ( " nThreadsScriptVerif " , value);
619
+ if (changed () ) {
620
+ update ( static_cast < int64_t >( value. toLongLong ()) );
624
621
setRestartRequired (true );
625
622
}
626
623
break ;
@@ -705,4 +702,5 @@ void OptionsModel::checkAndMigrate()
705
702
};
706
703
707
704
migrate_setting (DatabaseCache, " nDatabaseCache" );
705
+ migrate_setting (ThreadsScriptVerif, " nThreadsScriptVerif" );
708
706
}
0 commit comments