From dbda09d53001a5612db013cf4129f440c6fca698 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 27 Oct 2024 18:05:51 +0000 Subject: [PATCH 1/2] qt: re-run parameter interactions after setting new prune settings New prune settings aren't set until `InitPruneSetting()` is called at the tail end of init logic. The two opportunities we have to influence `-txindex` and `-disablegovernance`, `parameterSetup()` and `OptionsModel::Init()`, are executed well before `InitPruneSetting()` is run. So let's run `parameterSetup()` again to make sure parameter interactions affected by prune settings are processed appropriately. --- src/qt/bitcoin.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index d550e13136ac..ed42351cfc39 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -722,6 +722,9 @@ int GuiMain(int argc, char* argv[]) if (did_show_intro) { // Store intro dialog settings other than datadir (network specific) app.InitPruneSetting(prune_MiB); + // Run parameter interactions again to make sure parameters affected by + // new prune settings are processed + app.parameterSetup(); } if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !gArgs.GetBoolArg("-min", false)) From f139c75ccd81408b7f8198bec093e238d8f0c87f Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 27 Oct 2024 17:42:39 +0000 Subject: [PATCH 2/2] qt: use `addOverriddenOption` only if `SoftSetBoolArg` fails, remove log The startup warning that alerts us that governance is disabled and that it's expected when we're pruning is sufficient. --- src/qt/optionsmodel.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 7a58dbb4000f..d86427d25e0a 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -192,12 +192,10 @@ void OptionsModel::Init(bool resetSettings) // If GUI is setting prune, then we also must set disablegovernance and txindex if (settings.value("bPrune").toBool()) { - if (gArgs.SoftSetBoolArg("-disablegovernance", true)) { - LogPrintf("%s: parameter interaction: -prune=true -> setting -disablegovernance=true\n", __func__); + if (!gArgs.SoftSetBoolArg("-disablegovernance", true)) { addOverriddenOption("-disablegovernance"); } - if (gArgs.SoftSetBoolArg("-txindex", false)) { - LogPrintf("%s: parameter interaction: -prune=true -> setting -txindex=false\n", __func__); + if (!gArgs.SoftSetBoolArg("-txindex", false)) { addOverriddenOption("-txindex"); } }