From 301993ebf7f8ec23050e91377e0fd05823bb372a Mon Sep 17 00:00:00 2001 From: fanquake Date: Wed, 14 May 2025 15:50:34 +0100 Subject: [PATCH] init: drop -upnp This was slated for removal in 30.0, so remove it. --- doc/release-notes-32500.md | 3 +++ src/init.cpp | 28 ---------------------------- 2 files changed, 3 insertions(+), 28 deletions(-) create mode 100644 doc/release-notes-32500.md diff --git a/doc/release-notes-32500.md b/doc/release-notes-32500.md new file mode 100644 index 00000000000..31c0487f6ba --- /dev/null +++ b/doc/release-notes-32500.md @@ -0,0 +1,3 @@ +### Updated Settings + +- The `-upnp` setting has now been fully removed. Use `-natpmp` instead. (#32500) diff --git a/src/init.cpp b/src/init.cpp index dfc0724adf1..7ac0bbeb2b0 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -561,8 +561,6 @@ void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc) argsman.AddArg("-peertimeout=", strprintf("Specify a p2p connection timeout delay in seconds. After connecting to a peer, wait this amount of time before considering disconnection based on inactivity (minimum: 1, default: %d)", DEFAULT_PEER_CONNECT_TIMEOUT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CONNECTION); argsman.AddArg("-torcontrol=:", strprintf("Tor control host and port to use if onion listening enabled (default: %s). If no port is specified, the default port of %i will be used.", DEFAULT_TOR_CONTROL, DEFAULT_TOR_CONTROL_PORT), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); argsman.AddArg("-torpassword=", "Tor control port password (default: empty)", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::CONNECTION); - // UPnP support was dropped. We keep `-upnp` as a hidden arg to display a more user friendly error when set. TODO: remove (here and below) for 30.0. NOTE: removing this option may prevent the GUI from starting, see https://github.com/bitcoin-core/gui/issues/843. - argsman.AddArg("-upnp", "", ArgsManager::ALLOW_ANY, OptionsCategory::HIDDEN); argsman.AddArg("-natpmp", strprintf("Use PCP or NAT-PMP to map the listening port (default: %u)", DEFAULT_NATPMP), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); argsman.AddArg("-whitebind=<[permissions@]addr>", "Bind to the given address and add permission flags to the peers connecting to it. " "Use [host]:port notation for IPv6. Allowed permissions: " + Join(NET_PERMISSIONS_DOC, ", ") + ". " @@ -791,32 +789,6 @@ void InitParameterInteraction(ArgsManager& args) LogInfo("parameter interaction: -onlynet excludes IPv4 and IPv6 -> setting -dnsseed=0\n"); } } - - // If settings.json contains a "upnp" option, migrate it to use "natpmp" instead - bool settings_changed{false}; // Whether settings.json file needs to be rewritten - args.LockSettings([&](common::Settings& settings) { - if (auto* upnp{common::FindKey(settings.rw_settings, "upnp")}) { - if (common::FindKey(settings.rw_settings, "natpmp") == nullptr) { - LogWarning(R"(Adding "natpmp": %s to settings.json to replace obsolete "upnp" setting)", upnp->write()); - settings.rw_settings["natpmp"] = *upnp; - } - LogWarning(R"(Removing obsolete "upnp" setting from settings.json)"); - settings.rw_settings.erase("upnp"); - settings_changed = true; - } - }); - if (settings_changed) args.WriteSettingsFile(); - - // We dropped UPnP support but kept the arg as hidden for now to display a friendlier error to user who has the - // option in their config, and migrate the setting to -natpmp. - if (const auto arg{args.GetBoolArg("-upnp")}) { - std::string message; - if (args.SoftSetBoolArg("-natpmp", *arg)) { - message = strprintf(" Substituting '-natpmp=%s'.", *arg); - } - LogWarning("Option '-upnp=%s' is given but UPnP support was dropped in version 29.0.%s", - *arg, message); - } } /**