Gracefully handle dropped UPnP support #843

issue Sjors openend this issue on October 30, 2024
  1. Sjors commented at 9:57 pm on October 30, 2024: member

    https://github.com/bitcoin/bitcoin/pull/31130 dropped UPnP support. It’s now recommended that users use PCP (with NATPMP fallback).

    But this is not explained in a friendly manner:

    A user would have to figure out that they need to manually edit settings.json or delete it and redo all their settings.

    We should probably automatically delete it from settings.json. And then display a warning / info (instead of error) that tells users to consider the PCP setting in the GUI.

  2. laanwj commented at 7:41 am on October 31, 2024: member

    Even ignoring the spurious setting would be better in the GUI case. No need to rub this in the users face. i didn’t expect this consequence when i suggested adding a message 😅

    Though it’s still better than creashing with generic “-upnp: Unknown setting”. i guess…

    But yes this needs to be informational level at most, it should just continue.

    Even worse: i guess it even happens if the settings json specifies upnp=0 to explicitly disable it?

  3. laanwj added this to the milestone 29.0 on Oct 31, 2024
  4. maflcko commented at 10:11 am on October 31, 2024: contributor
    An easy first fix would be to downgrade InitError to InitWarning, as the alert shouldn’t be fatal, as it is possible to continue without it. (This applies to bitcoind as well)
  5. darosior commented at 1:35 pm on October 31, 2024: member

    Thanks Maflcko, i think it’s a good short term solution to fix what i just broke. I’ll open a PR shortly.

    That said, it does seem unknown entries in settings.json should be ignored by the GUI as it’s a file the user isn’t supposed to edit? Right now it’s assuming we will never remove a startup option, which isn’t very robust.

  6. Sjors commented at 4:32 pm on October 31, 2024: member
    @darosior I could imagine a scenario in which we remove a Tor related setting and it would be unsafe to simply ignore it. But that’s not the case here.
  7. laanwj commented at 7:21 pm on October 31, 2024: member

    An easy first fix would be to downgrade InitError to InitWarning, as the alert shouldn’t be fatal, as it is possible to continue without it. (This applies to bitcoind as well)

    Do we also need to explicitly remote the entry from settings.json as well, to make sure the message doesn’t appear at every start after that. Or does this happen automatically in re-saving it (at shutdown) somehow?

  8. achow101 closed this on Nov 1, 2024

  9. achow101 referenced this in commit 975b115e1a on Nov 1, 2024
  10. maflcko commented at 11:35 am on November 2, 2024: contributor
    I don’t think this was fixed fully for the gui
  11. maflcko reopened this on Nov 2, 2024

  12. fanquake commented at 12:39 pm on January 23, 2025: member

    This is tagged for 29.x, but it’s not exactly clear what needs doing, or if anyone is working on it.

    Anyone migrating from 28.x to 29.x, who previously had the upnp/natpmp options selected, will currently see this at every startup, with no way to fix from the UI, as far as I understand:

  13. laanwj assigned laanwj on Jan 23, 2025
  14. laanwj commented at 2:30 pm on January 23, 2025: member
    Will take a look.
  15. darosior commented at 2:45 pm on January 23, 2025: member

    with no way to fix from the UI

    Can’t they just unset it in the UI settings?

  16. fanquake commented at 2:46 pm on January 23, 2025: member

    Can’t they just unset it in the UI settings?

    No, because the checkbox for upnp no longer exists.

  17. darosior commented at 2:51 pm on January 23, 2025: member
    Ah right, didn’t swap context back in.
  18. maflcko commented at 1:51 pm on February 14, 2025: contributor

    Looks like this is still up for grabs, waiting on a pull request for 29.x.

    Can’t they just unset it in the UI settings?

    No, because the checkbox for upnp no longer exists.

    Also not with a previous release as a workaround?

  19. Sjors commented at 2:09 pm on February 14, 2025: member
    I suspect “unset” will store upnp=0 in the settings which would still be an error.
  20. darosior commented at 9:31 pm on February 19, 2025: member

    Will take a look. @laanwj did you get a chance to look into this? Else i guess it falls on me to take care of this before deadline..

  21. laanwj commented at 1:17 pm on February 20, 2025: member

    @laanwj did you get a chance to look into this? Else i guess it falls on me to take care of this before deadline..

    Whoops. No i didn’t, i lost track of the deadline (which, assuming this is considered a bugfix is 2025-03-06, according to #31029), sorry. i will have a look at it today and tomorrow, if i don’t manage to figure out this week, it would be great if you can take it over.

  22. darosior commented at 1:19 pm on February 20, 2025: member

    Sounds good, thanks for looking into it.

    ——– Original Message ——– On 2/20/25 8:17 AM, laanwj wrote:

    @.***(https://github.com/laanwj) did you get a chance to look into this? Else i guess it falls on me to take care of this before deadline..

    Whoops. No i didn’t, i lost track of the deadline (which, assuming this is considered a bugfix is 2025-03-06, according to #31029), sorry. i will have a look at it today and tomorrow, if i don’t manage to figure out this week, it would be great if you can take it over.

    — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

    [laanwj]laanwj left a comment (bitcoin-core/gui#843)

    @.***(https://github.com/laanwj) did you get a chance to look into this? Else i guess it falls on me to take care of this before deadline..

    Whoops. No i didn’t, i lost track of the deadline (which, assuming this is considered a bugfix is 2025-03-06, according to #31029), sorry. i will have a look at it today and tomorrow, if i don’t manage to figure out this week, it would be great if you can take it over.

    — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

  23. ryanofsky commented at 2:02 pm on February 20, 2025: contributor

    I’m not sure there is a strong justification for the -upnp option to trigger an interactive warning now, if it was always just a best-effort setting that wouldn’t previously fail if it couldn’t register with the upnp server., or the server wouldn’t provide a port or external ip. Since anyone relying on this would need external monitoring or testing to know if it was working anyway, just using LogWarning here seems like it should be ok.

    But if I’m underestimating the importance of having an interactive warning, it would be possible to trigger it only when the upnp setting is enabled on the command line or config file, not when the setting is specified in the settings.json file by adding an argsmanager method to check if a setting is present in Settings::command_line_options or Settings::ro_config maps.

  24. laanwj commented at 2:18 pm on February 20, 2025: member

    @ryanofsky For this specific setting it isn’t too important imo. It would be critical for a disappearing privacy setting, but not for a setting that opens up more network surface.

    But i do think it would be nice to warn once before dropping it from settings.json. i mean our goal with this change is to encourage people to enable port forwarding to have more connectable nodes. So a reminder to use NAT-PMP instead instead is good.

  25. ryanofsky commented at 2:24 pm on February 20, 2025: contributor

    Relatedly, I think QSetttings migration code could be also be improved: https://github.com/bitcoin/bitcoin/pull/31130#discussion_r1963647337

    And I think the warning message could be much more descriptive because it’s possible someone enabled this setting a long time ago without a full understanding of what it does, and the message doesn’t provide any context. Might suggest a warning like:

    • The -upnp setting is enabled, but this setting is no longer supported as of Bitcoin Core 0.29. This means if if the node is running behind a firewall, it may be unable to accept incoming connections. As a result, node and wallets on this machine will continue to function, but the node may not contribute as much bandwidth and resources to the rest of the network. To resolve this warning, the -upnp setting should be disabled or removed. If accepting incoming connections is important, alternatives to enabling -upnp include enabling -natpmp, manually configuring the firewall, or running the node on a host with an external IP.
  26. ryanofsky commented at 2:26 pm on February 20, 2025: contributor

    But i do think it would be nice to warn once before dropping it from settings.json. i mean our goal with this change is to encourage people to enable port forwarding to have more connectable nodes. So a reminder to use NAT-PMP instead instead is good.

    This also does sound like a good idea, and should not be too hard to implement. though not quite as easy as replacing InitWarning with LogWarning. It could also be done at any point in the future after changing InitWarning to LogWarning.

  27. laanwj commented at 2:29 pm on February 20, 2025: member
    Another alternative would be to automatically “upgrade” -upnp to -natpmp . With a LogWarning but not an UI warning. i don’t think most users care about what method of automatic port forwarding method is used?
  28. laanwj referenced this in commit 307f6f5fdb on Feb 20, 2025
  29. laanwj referenced this in commit bd4679a608 on Feb 20, 2025
  30. laanwj referenced this in commit 500689e3c4 on Feb 22, 2025
  31. laanwj referenced this in commit 96af9d7597 on Feb 22, 2025
  32. laanwj referenced this in commit 4d598357cb on Feb 23, 2025
  33. laanwj referenced this in commit 64de0a22db on Feb 23, 2025
  34. laanwj referenced this in commit 44041ae0ec on Feb 26, 2025
  35. achow101 closed this on Mar 4, 2025

  36. achow101 referenced this in commit 15717f0ef3 on Mar 4, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-05-09 05:20 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me