From 844770b05ebc34789dc46d70cd6398089539c915 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Sun, 20 Oct 2024 20:29:08 +0200 Subject: [PATCH] qt: remove UPnP settings --- src/qt/forms/optionsdialog.ui | 10 ---------- src/qt/optionsdialog.cpp | 5 ----- src/qt/optionsmodel.cpp | 20 +++----------------- src/qt/optionsmodel.h | 1 - src/qt/test/optiontests.cpp | 3 --- src/qt/test/test_main.cpp | 1 - 6 files changed, 3 insertions(+), 37 deletions(-) diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 2056b2cccd9..9ab6b124e0d 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -315,16 +315,6 @@ &Network - - - - Automatically open the Bitcoin client port on the router. This only works when your router supports UPnP and it is enabled. - - - Map port using &UPnP - - - diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index b70769ed240..f821b1ceb2e 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -105,10 +105,6 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet) connect(ui->prune, &QPushButton::toggled, ui->pruneSize, &QWidget::setEnabled); /* Network elements init */ -#ifndef USE_UPNP - ui->mapPortUpnp->setEnabled(false); -#endif - ui->proxyIp->setEnabled(false); ui->proxyPort->setEnabled(false); ui->proxyPort->setValidator(new QIntValidator(1, 65535, this)); @@ -300,7 +296,6 @@ void OptionsDialog::setMapper() mapper->addMapping(ui->m_enable_psbt_controls, OptionsModel::EnablePSBTControls); /* Network */ - mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP); mapper->addMapping(ui->mapPortNatpmp, OptionsModel::MapPortNatpmp); mapper->addMapping(ui->allowIncoming, OptionsModel::Listen); mapper->addMapping(ui->enableServer, OptionsModel::Server); diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 5bca5c5320e..acaa02aa858 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -41,7 +41,6 @@ static const char* SettingName(OptionsModel::OptionID option) case OptionsModel::ThreadsScriptVerif: return "par"; case OptionsModel::SpendZeroConfChange: return "spendzeroconfchange"; case OptionsModel::ExternalSignerPath: return "signer"; - case OptionsModel::MapPortUPnP: return "upnp"; case OptionsModel::MapPortNatpmp: return "natpmp"; case OptionsModel::Listen: return "listen"; case OptionsModel::Server: return "server"; @@ -215,7 +214,7 @@ bool OptionsModel::Init(bilingual_str& error) // These are shared with the core or have a command-line parameter // and we want command-line parameters to overwrite the GUI settings. - for (OptionID option : {DatabaseCache, ThreadsScriptVerif, SpendZeroConfChange, ExternalSignerPath, MapPortUPnP, + for (OptionID option : {DatabaseCache, ThreadsScriptVerif, SpendZeroConfChange, ExternalSignerPath, MapPortNatpmp, Listen, Server, Prune, ProxyUse, ProxyUseTor, Language}) { std::string setting = SettingName(option); if (node().isSettingIgnored(setting)) addOverriddenOption("-" + setting); @@ -412,12 +411,6 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con return m_show_tray_icon; case MinimizeToTray: return fMinimizeToTray; - case MapPortUPnP: -#ifdef USE_UPNP - return SettingToBool(setting(), DEFAULT_UPNP); -#else - return false; -#endif // USE_UPNP case MapPortNatpmp: return SettingToBool(setting(), DEFAULT_NATPMP); case MinimizeOnClose: @@ -530,16 +523,10 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std:: fMinimizeToTray = value.toBool(); settings.setValue("fMinimizeToTray", fMinimizeToTray); break; - case MapPortUPnP: // core option - can be changed on-the-fly - if (changed()) { - update(value.toBool()); - node().mapPort(value.toBool(), getOption(MapPortNatpmp).toBool()); - } - break; case MapPortNatpmp: // core option - can be changed on-the-fly if (changed()) { update(value.toBool()); - node().mapPort(getOption(MapPortUPnP).toBool(), value.toBool()); + node().mapPort(false, value.toBool()); } break; case MinimizeOnClose: @@ -789,7 +776,6 @@ void OptionsModel::checkAndMigrate() migrate_setting(SpendZeroConfChange, "bSpendZeroConfChange"); migrate_setting(ExternalSignerPath, "external_signer_path"); #endif - migrate_setting(MapPortUPnP, "fUseUPnP"); migrate_setting(MapPortNatpmp, "fUseNatpmp"); migrate_setting(Listen, "fListen"); migrate_setting(Server, "server"); @@ -803,7 +789,7 @@ void OptionsModel::checkAndMigrate() // In case migrating QSettings caused any settings value to change, rerun // parameter interaction code to update other settings. This is particularly - // important for the -listen setting, which should cause -listenonion, -upnp, + // important for the -listen setting, which should cause -listenonion // and other settings to default to false if it was set to false. // (https://github.com/bitcoin-core/gui/issues/567). node().initParameterInteraction(); diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index b5ea6c783e4..c24b35ed793 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -50,7 +50,6 @@ public: StartAtStartup, // bool ShowTrayIcon, // bool MinimizeToTray, // bool - MapPortUPnP, // bool MapPortNatpmp, // bool MinimizeOnClose, // bool ProxyUse, // bool diff --git a/src/qt/test/optiontests.cpp b/src/qt/test/optiontests.cpp index 4f3eb778c56..4d25d4994d2 100644 --- a/src/qt/test/optiontests.cpp +++ b/src/qt/test/optiontests.cpp @@ -37,7 +37,6 @@ void OptionTests::migrateSettings() QSettings settings; settings.setValue("nDatabaseCache", 600); settings.setValue("nThreadsScriptVerif", 12); - settings.setValue("fUseUPnP", false); settings.setValue("fListen", false); settings.setValue("bPrune", true); settings.setValue("nPruneSize", 3); @@ -50,7 +49,6 @@ void OptionTests::migrateSettings() QVERIFY(settings.contains("nDatabaseCache")); QVERIFY(settings.contains("nThreadsScriptVerif")); - QVERIFY(settings.contains("fUseUPnP")); QVERIFY(settings.contains("fListen")); QVERIFY(settings.contains("bPrune")); QVERIFY(settings.contains("nPruneSize")); @@ -64,7 +62,6 @@ void OptionTests::migrateSettings() QVERIFY(options.Init(error)); QVERIFY(!settings.contains("nDatabaseCache")); QVERIFY(!settings.contains("nThreadsScriptVerif")); - QVERIFY(!settings.contains("fUseUPnP")); QVERIFY(!settings.contains("fListen")); QVERIFY(!settings.contains("bPrune")); QVERIFY(!settings.contains("nPruneSize")); diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index 172c06f4ea6..f3430c7822a 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -54,7 +54,6 @@ int main(int argc, char* argv[]) gArgs.ForceSetArg("-discover", "0"); gArgs.ForceSetArg("-dnsseed", "0"); gArgs.ForceSetArg("-fixedseeds", "0"); - gArgs.ForceSetArg("-upnp", "0"); gArgs.ForceSetArg("-natpmp", "0"); std::string error;