fix: force correct -disablegovernance and -txindex values when pruning is requested via init dialog

This commit is contained in:
UdjinM6 2024-10-28 22:30:30 +03:00
parent 64b20f0691
commit 2d99b2c02b
No known key found for this signature in database
GPG Key ID: 83592BD1400D58D9

View File

@ -391,21 +391,21 @@ void OptionsModel::SetPruneEnabled(bool prune, bool force)
settings.setValue("bPrune", prune);
const int64_t prune_target_mib = PruneGBtoMiB(settings.value("nPruneSize").toInt());
std::string prune_val = prune ? ToString(prune_target_mib) : "0";
auto maybe_adjust_dash_options = [](){
if (gArgs.GetArg("-prune", 0) > 0) {
gArgs.SoftSetBoolArg("-disablegovernance", true);
gArgs.SoftSetBoolArg("-txindex", false);
}
};
if (force) {
gArgs.ForceSetArg("-prune", prune_val);
maybe_adjust_dash_options();
if (prune) {
gArgs.ForceSetArg("-disablegovernance", "1");
gArgs.ForceSetArg("-txindex", "0");
}
return;
}
if (!gArgs.SoftSetArg("-prune", prune_val)) {
addOverriddenOption("-prune");
}
maybe_adjust_dash_options();
if (gArgs.GetArg("-prune", 0) > 0) {
gArgs.SoftSetBoolArg("-disablegovernance", true);
gArgs.SoftSetBoolArg("-txindex", false);
}
}
void OptionsModel::SetPruneTargetGB(int prune_target_gb, bool force)