Skip to content

Commit 301993e

Browse files
committed
init: drop -upnp
This was slated for removal in 30.0, so remove it.
1 parent f1d78a3 commit 301993e

File tree

2 files changed

+3
-28
lines changed

2 files changed

+3
-28
lines changed

doc/release-notes-32500.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Updated Settings
2+
3+
- The `-upnp` setting has now been fully removed. Use `-natpmp` instead. (#32500)

src/init.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,6 @@ void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc)
561561
argsman.AddArg("-peertimeout=<n>", 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);
562562
argsman.AddArg("-torcontrol=<ip>:<port>", 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);
563563
argsman.AddArg("-torpassword=<pass>", "Tor control port password (default: empty)", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::CONNECTION);
564-
// 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.
565-
argsman.AddArg("-upnp", "", ArgsManager::ALLOW_ANY, OptionsCategory::HIDDEN);
566564
argsman.AddArg("-natpmp", strprintf("Use PCP or NAT-PMP to map the listening port (default: %u)", DEFAULT_NATPMP), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
567565
argsman.AddArg("-whitebind=<[permissions@]addr>", "Bind to the given address and add permission flags to the peers connecting to it. "
568566
"Use [host]:port notation for IPv6. Allowed permissions: " + Join(NET_PERMISSIONS_DOC, ", ") + ". "
@@ -791,32 +789,6 @@ void InitParameterInteraction(ArgsManager& args)
791789
LogInfo("parameter interaction: -onlynet excludes IPv4 and IPv6 -> setting -dnsseed=0\n");
792790
}
793791
}
794-
795-
// If settings.json contains a "upnp" option, migrate it to use "natpmp" instead
796-
bool settings_changed{false}; // Whether settings.json file needs to be rewritten
797-
args.LockSettings([&](common::Settings& settings) {
798-
if (auto* upnp{common::FindKey(settings.rw_settings, "upnp")}) {
799-
if (common::FindKey(settings.rw_settings, "natpmp") == nullptr) {
800-
LogWarning(R"(Adding "natpmp": %s to settings.json to replace obsolete "upnp" setting)", upnp->write());
801-
settings.rw_settings["natpmp"] = *upnp;
802-
}
803-
LogWarning(R"(Removing obsolete "upnp" setting from settings.json)");
804-
settings.rw_settings.erase("upnp");
805-
settings_changed = true;
806-
}
807-
});
808-
if (settings_changed) args.WriteSettingsFile();
809-
810-
// We dropped UPnP support but kept the arg as hidden for now to display a friendlier error to user who has the
811-
// option in their config, and migrate the setting to -natpmp.
812-
if (const auto arg{args.GetBoolArg("-upnp")}) {
813-
std::string message;
814-
if (args.SoftSetBoolArg("-natpmp", *arg)) {
815-
message = strprintf(" Substituting '-natpmp=%s'.", *arg);
816-
}
817-
LogWarning("Option '-upnp=%s' is given but UPnP support was dropped in version 29.0.%s",
818-
*arg, message);
819-
}
820792
}
821793

822794
/**

0 commit comments

Comments
 (0)