GUI/Options: Disable peerblockfilters option if pruning is already enabled but basic blockfilterindex is not

Otherwise, enabling it will prompt the user to restart, and restart will fail
This commit is contained in:
Luke Dashjr 2025-01-27 16:10:18 +00:00
parent c089a0d22f
commit db8eba71d5

View File

@ -14,6 +14,7 @@
#include <qt/optionsmodel.h>
#include <common/system.h>
#include <index/blockfilterindex.h>
#include <interfaces/node.h>
#include <node/chainstatemanager_args.h>
#include <netbase.h>
@ -363,6 +364,13 @@ void OptionsDialog::setMapper()
mapper->addMapping(ui->peerbloomfilters, OptionsModel::peerbloomfilters);
mapper->addMapping(ui->peerblockfilters, OptionsModel::peerblockfilters);
if (prune_checkstate != Qt::Unchecked && !GetBlockFilterIndex(BlockFilterType::BASIC)) {
// Once pruning begins, it's too late to enable block filters, and doing so will prevent starting the client
// Rather than try to monitor sync state, just disable the option once pruning is enabled
// Advanced users can override this manually anyway
ui->peerblockfilters->setEnabled(false);
ui->peerblockfilters->setToolTip(ui->peerblockfilters->toolTip() + " " + tr("(only available if enabled at least once before turning on pruning)"));
}
/* Window */
#ifndef Q_OS_MACOS