Skip to content

Commit eed631a

Browse files
committed
refactor: spin-off list of option IDs that require string workaround
We have a lot more configurable options and the current approach will get unwieldy as it grows
1 parent dd21992 commit eed631a

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/qt/optionsmodel.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,23 @@ static const char* SettingName(OptionsModel::OptionID option)
6464
}
6565
}
6666

67+
static bool RequiresNumWorkaround(OptionsModel::OptionID option)
68+
{
69+
switch (option) {
70+
case OptionsModel::DatabaseCache:
71+
case OptionsModel::Prune:
72+
case OptionsModel::PruneSize:
73+
case OptionsModel::ThreadsScriptVerif:
74+
return true;
75+
default:
76+
return false;
77+
}
78+
}
79+
6780
/** Call node.updateRwSetting() with Bitcoin 22.x workaround. */
6881
static void UpdateRwSetting(interfaces::Node& node, OptionsModel::OptionID option, const util::SettingsValue& value)
6982
{
70-
if (value.isNum() &&
71-
(option == OptionsModel::DatabaseCache ||
72-
option == OptionsModel::ThreadsScriptVerif ||
73-
option == OptionsModel::Prune ||
74-
option == OptionsModel::PruneSize)) {
83+
if (value.isNum() && RequiresNumWorkaround(option)) {
7584
// Write certain old settings as strings, even though they are numbers,
7685
// because Bitcoin 22.x releases try to read these specific settings as
7786
// strings in addOverriddenOption() calls at startup, triggering

0 commit comments

Comments
 (0)