Skip to content

Commit 93cfd5b

Browse files
Merge #6368: fix(qt): set prune dependent options correctly
2d99b2c fix: force correct `-disablegovernance` and `-txindex` values when pruning is requested via init dialog (UdjinM6) 64b20f0 fix(qt): set prune dependent options correctly (Kittywhiskers Van Gogh) Pull request description: ## Issue being fixed or feature implemented A few things to note: 1. we shouldn't rely on `bPrune` cause it can be overridden via cmd-line 2. `addOverriddenOption` is used to highlight that there are GUI options that were overridden via cmd-line and neither `-disablegovernance` nor `-txindex` override anything, we simply set them to correct values here. 3. we should do all that in `SetPruneEnabled` case that's the central point for GUI prune option logic fixes #6366 #6367 alternative ## What was done? ## How Has This Been Tested? `./src/qt/dash-qt --regtest --resetguisettings` (could also add `--txindex=1` and/or `--disablegovernance=0`), check "Limit ..." box, click OK and confirm it continues with no errors (but with a warning about disabled governance, that's by design) close qt and check 2 more things: 1. `./src/qt/dash-qt --regtest` should have a warning about disabled governance 2. `./src/qt/dash-qt --regtest --prune=0` should have no warning about disabled governance (not true on `develop`) ## Breaking Changes ## Checklist: - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: kwvg: ACK 2d99b2c PastaPastaPasta: utACK 2d99b2c Tree-SHA512: 465bd2f1ca86358145c4671af554078b00b2472375d65b8de7e01ae0db8b24c9b01844a2b8e5a4c85a6d65a892a169ee61797591c0dfc0f51ec044a8e2bba58a
2 parents 79ced62 + 2d99b2c commit 93cfd5b

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/qt/optionsmodel.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,6 @@ void OptionsModel::Init(bool resetSettings)
190190
settings.setValue("nPruneSize", DEFAULT_PRUNE_TARGET_GB);
191191
SetPruneEnabled(settings.value("bPrune").toBool());
192192

193-
// If GUI is setting prune, then we also must set disablegovernance and txindex
194-
if (settings.value("bPrune").toBool()) {
195-
if (gArgs.SoftSetBoolArg("-disablegovernance", true)) {
196-
LogPrintf("%s: parameter interaction: -prune=true -> setting -disablegovernance=true\n", __func__);
197-
addOverriddenOption("-disablegovernance");
198-
}
199-
if (gArgs.SoftSetBoolArg("-txindex", false)) {
200-
LogPrintf("%s: parameter interaction: -prune=true -> setting -txindex=false\n", __func__);
201-
addOverriddenOption("-txindex");
202-
}
203-
}
204-
205193
if (!settings.contains("nDatabaseCache"))
206194
settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
207195
if (!gArgs.SoftSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString()))
@@ -405,11 +393,19 @@ void OptionsModel::SetPruneEnabled(bool prune, bool force)
405393
std::string prune_val = prune ? ToString(prune_target_mib) : "0";
406394
if (force) {
407395
gArgs.ForceSetArg("-prune", prune_val);
396+
if (prune) {
397+
gArgs.ForceSetArg("-disablegovernance", "1");
398+
gArgs.ForceSetArg("-txindex", "0");
399+
}
408400
return;
409401
}
410402
if (!gArgs.SoftSetArg("-prune", prune_val)) {
411403
addOverriddenOption("-prune");
412404
}
405+
if (gArgs.GetArg("-prune", 0) > 0) {
406+
gArgs.SoftSetBoolArg("-disablegovernance", true);
407+
gArgs.SoftSetBoolArg("-txindex", false);
408+
}
413409
}
414410

415411
void OptionsModel::SetPruneTargetGB(int prune_target_gb, bool force)

0 commit comments

Comments
 (0)