Skip to content

Conversation

@fanquake
Copy link
Member

This is a very belated followup to #26896 (which removed the configure options for setting the upnp and natpmp runtime default) and corrects the -help docs for -upnp and -natpmp.

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 14, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK davidgumberg, hernanmarino

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@fanquake fanquake changed the title Redundant upnp ifdef doc: fixup help output for -upnp and -natpmp Nov 14, 2023
@DrahtBot DrahtBot added the Docs label Nov 14, 2023
src/init.cpp Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
argsman.AddArg("-upnp", strprintf("Use UPnP to map the listening port (default: %s)", DEFAULT_UPNP), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
argsman.AddArg("-upnp", strprintf("Use UPnP to map the listening port (default: %s)", !Assert(!DEFAULT_UPNP)), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);

Otherwise it would be incorrect (missing "when listening and no -proxy") if DEFAULT_UPNP flips to true.

Alternatively, just remove the SoftSetArg stuff...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if DEFAULT_UPNP flips to true.

I very much doubt we would ever return to shipping upnp/natpmp on by default.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hence why it might make more sense to just remove the SoftSetArg stuff that gives it a conditional default in that case

src/init.cpp Outdated
Copy link
Member

@luke-jr luke-jr Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%s will make DEFAULT_NATPMP "false" here instead of "0", I think...

This always defaults to false, since we removed the compile time options
to set it otherwise.
@davidgumberg
Copy link
Contributor

ACK 92f88a9

Configured --with-natpmp and verified the help messages.

$ bitcoind --help

[...]
  -natpmp
       Use NAT-PMP to map the listening port (default: 0)
[...]
  -upnp
       Use UPnP to map the listening port (default: 0)

Verified that modifying bool DEFAULT_UPNP and bool DEFAULT_NATPMP changes the --help output.

Copy link
Contributor

@hernanmarino hernanmarino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 92f88a9

@fanquake fanquake merged commit 58446e1 into bitcoin:master Apr 15, 2024
@fanquake fanquake deleted the redundant_upnp_ifdef branch April 15, 2024 12:10
@bitcoin bitcoin locked and limited conversation to collaborators Apr 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants