Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to open bitcoin-qt when incoming connections disabled in settings #567

Open
ghost opened this issue Mar 22, 2022 · 11 comments · Fixed by #568
Open

Unable to open bitcoin-qt when incoming connections disabled in settings #567

ghost opened this issue Mar 22, 2022 · 11 comments · Fixed by #568
Labels
Bug Something isn't working
Milestone

Comments

@ghost
Copy link

ghost commented Mar 22, 2022

bitcoin-qt throws an error and crashes if incoming connections are disabled in settings. This did not happen in v22.0 but noticed it in RC2 during testing.

Expected behavior

Disable listenonion and launch bitcoin-qt automatically.
No error and bitcoin-qt should start as it happens with v22.0

Actual behavior

image

image

To reproduce

  1. Download v22.0, run and disable incoming connections in settings
  2. Restart bitcoin-qt
  3. Download RC2, run and look for errors when incoming connections are disabled

System information

Confirmed the issue on Ubuntu and Windows

@ghost ghost added the Bug Something isn't working label Mar 22, 2022
@hebasto
Copy link
Member

hebasto commented Mar 22, 2022

Isn't an error message self-descriptive?

FWIW, the behavior is not GUI-specific:

$ ./bin/bitcoind -listen=0 -listenonion=1
Error: Cannot set -listen=0 together with -listenonion=1

@hebasto
Copy link
Member

hebasto commented Mar 22, 2022

The behavior was changed in bitcoin/bitcoin#20769.

@hebasto hebasto added Questions and Help and removed Bug Something isn't working labels Mar 22, 2022
@hebasto
Copy link
Member

hebasto commented Mar 22, 2022

@1440000bytes

Thank you for testing v23.0rc2!

As this issue describes the expected behavior, could it be closed now?

@ghost
Copy link
Author

ghost commented Mar 22, 2022

Isn't an error message self-descriptive?

It is, although there was a change in behavior compared to last release and not all gui users know usage of command line parameters.

FWIW, the behavior is not GUI-specific:

I am running bitcoin-qt binary with nothing in config, no command line parameters and incoming connections unchecked in settings.

The behavior was changed in bitcoin/bitcoin#20769.

According to pull request it should enforce listenonion=0 when the listen is 0. Error says listenionion is 1.

@1440000bytes

Thank you for testing v23.0rc2!

As this issue describes the expected behavior, could it be closed now?

Expected behavior is no error and bitcoin-qt should start as it happens with v22.0

@hebasto
Copy link
Member

hebasto commented Mar 22, 2022

@1440000bytes

Yes, new behavior looks contra-intuitive.

@hebasto hebasto added Bug Something isn't working and removed Questions and Help labels Mar 22, 2022
@hebasto hebasto added this to the 23.0 milestone Mar 22, 2022
@hebasto
Copy link
Member

hebasto commented Mar 22, 2022

@1440000bytes

As a temporary workaround suggesting to run bitcoin-qt -resetguisettings.

@hebasto
Copy link
Member

hebasto commented Mar 23, 2022

@1440000bytes

Do you mind testing bitcoin/bitcoin#24648 #568?

@vasild
Copy link
Contributor

vasild commented Mar 23, 2022

To reproduce:

  • start bitcoin-qt, go to settings -> network and remove the checkbox from "Allow incoming connections"
  • shut down
  • start bitcoin-qt - it refuses to start with Error: Cannot set -listen=0 together with -listenonion=1

That "Allow incoming connections" setting is saved in ~/.config/Bitcoin/Bitcoin-Qt.conf under fListen=false.

The problem is that during bitcoin-qt startup, when fListen=false in ~/.config/Bitcoin/Bitcoin-Qt.conf, then:

  • When InitParameterInteraction() executes, args.GetBoolArg("-listen", DEFAULT_LISTEN) is true (!?), so listenonion's default value is not flipped from true to false
  • When AppInitParameterInteraction() executes, args.GetBoolArg("-listen", DEFAULT_LISTEN) is false and listenonion is still with its default value (true), untouched by the user. Thus the error due to the incompatible options.

vasild added a commit to vasild/bitcoin-core-gui that referenced this issue Mar 23, 2022
If the user has unchecked "Allow incoming connections" in
`Settings->Options...->Network` then `fListen=false` is saved in
`~/.config/Bitcoin/Bitcoin-Qt.conf`. This flips `-listen` to `false`
during startup, but leaves `-listenonion` to `true`.

This flipping is done in `OptionsModel::Init()` after
`InitParameterInteraction()` has been executed which would have flipped
it itself (difference between `bitcoind` and `bitcoin-qt`).

Fixes: bitcoin-core#567
hebasto added a commit that referenced this issue Mar 23, 2022
7f90dc2 options: flip listenonion to false if not listening (Vasil Dimov)

Pull request description:

  If the user has unchecked "Allow incoming connections" in
  `Settings->Options...->Network` then `fListen=false` is saved in
  `~/.config/Bitcoin/Bitcoin-Qt.conf`. This flips `-listen` to `false`
  during startup, but leaves `-listenonion` to `true`.

  This flipping of `-listen` is done in `OptionsModel::Init()` after
  `InitParameterInteraction()` has been executed which would have flipped
  `-listenonion`, should it have seen `-listen` being `false`
  (this is a difference between `bitcoind` and `bitcoin-qt`).

  Fixes: #567

ACKs for top commit:
  mzumsande:
    Tested ACK 7f90dc2
  hebasto:
    ACK 7f90dc2
  jonatack:
    utACK 7f90dc2
  ryanofsky:
    Code review ACK 7f90dc2.

Tree-SHA512: ff5095096858eae696293dc58d1cd5bd1bb60ef7c5d07d87308a0cf71c67da88cc00b301b550704625f136c4ba3a29905a934a766535a6422fe85d9662299d32
hebasto pushed a commit to hebasto/bitcoin that referenced this issue Mar 23, 2022
If the user has unchecked "Allow incoming connections" in
`Settings->Options...->Network` then `fListen=false` is saved in
`~/.config/Bitcoin/Bitcoin-Qt.conf`. This flips `-listen` to `false`
during startup, but leaves `-listenonion` to `true`.

This flipping of `-listen` is done in `OptionsModel::Init()` after
`InitParameterInteraction()` has been executed which would have flipped
`-listenonion`, should it have seen `-listen` being `false`
(this is a difference between `bitcoind` and `bitcoin-qt`).

Fixes: bitcoin-core/gui#567

Github-Pull: bitcoin-core/gui#568
Rebased-From: 7f90dc2
sidhujag pushed a commit to syscoin/syscoin that referenced this issue Mar 24, 2022
… listening

7f90dc2 options: flip listenonion to false if not listening (Vasil Dimov)

Pull request description:

  If the user has unchecked "Allow incoming connections" in
  `Settings->Options...->Network` then `fListen=false` is saved in
  `~/.config/Bitcoin/Bitcoin-Qt.conf`. This flips `-listen` to `false`
  during startup, but leaves `-listenonion` to `true`.

  This flipping of `-listen` is done in `OptionsModel::Init()` after
  `InitParameterInteraction()` has been executed which would have flipped
  `-listenonion`, should it have seen `-listen` being `false`
  (this is a difference between `bitcoind` and `bitcoin-qt`).

  Fixes: bitcoin-core/gui#567

ACKs for top commit:
  mzumsande:
    Tested ACK 7f90dc2
  hebasto:
    ACK 7f90dc2
  jonatack:
    utACK 7f90dc2
  ryanofsky:
    Code review ACK 7f90dc2.

Tree-SHA512: ff5095096858eae696293dc58d1cd5bd1bb60ef7c5d07d87308a0cf71c67da88cc00b301b550704625f136c4ba3a29905a934a766535a6422fe85d9662299d32
vasild added a commit to vasild/bitcoin that referenced this issue Mar 24, 2022
vasild added a commit to vasild/bitcoin-core-gui that referenced this issue Mar 24, 2022
fujicoin pushed a commit to fujicoin/fujicoin-23.0 that referenced this issue Mar 25, 2022
If the user has unchecked "Allow incoming connections" in
`Settings->Options...->Network` then `fListen=false` is saved in
`~/.config/Bitcoin/Bitcoin-Qt.conf`. This flips `-listen` to `false`
during startup, but leaves `-listenonion` to `true`.

This flipping of `-listen` is done in `OptionsModel::Init()` after
`InitParameterInteraction()` has been executed which would have flipped
`-listenonion`, should it have seen `-listen` being `false`
(this is a difference between `bitcoind` and `bitcoin-qt`).

Fixes: bitcoin-core/gui#567

Github-Pull: bitcoin-core/gui#568
Rebased-From: 7f90dc26c8938f348938929b6d8bf1ea6f149209
vasild added a commit to vasild/bitcoin that referenced this issue Mar 31, 2022
vasild added a commit to vasild/bitcoin-core-gui that referenced this issue Apr 1, 2022
hebasto added a commit that referenced this issue Apr 4, 2022
4d4dca4 test: add regression test for /issues/567 (Vasil Dimov)
3b82608 options: add a comment for -listenonion and dedup a long expression (Vasil Dimov)

Pull request description:

  Add a test that would fail, should #567 resurface.

  Also, add a comment and dedup a long expression.

ACKs for top commit:
  jarolrod:
    reACK 4d4dca4
  jonatack:
    ACK 4d4dca4
  hebasto:
    ACK 4d4dca4, tested with reverting changes from #568, and getting an expected test failure.
  shaavan:
    ACK 4d4dca4

Tree-SHA512: 59f069bdaa84586bb599e9372f89e4e66a3cafcbf58677fdf913d685c17dfa9c3d5b118829d81021a9a33b4fd8e46d4c7eb68c1dd902cf1c44a41b8e66e2967b
janus pushed a commit to BitgesellOfficial/bitgesell that referenced this issue Aug 4, 2022
If the user has unchecked "Allow incoming connections" in
`Settings->Options...->Network` then `fListen=false` is saved in
`~/.config/Bitcoin/Bitcoin-Qt.conf`. This flips `-listen` to `false`
during startup, but leaves `-listenonion` to `true`.

This flipping of `-listen` is done in `OptionsModel::Init()` after
`InitParameterInteraction()` has been executed which would have flipped
`-listenonion`, should it have seen `-listen` being `false`
(this is a difference between `bitcoind` and `bitcoin-qt`).

Fixes: bitcoin-core/gui#567
janus pushed a commit to BitgesellOfficial/bitgesell that referenced this issue Aug 4, 2022
backpacker69 pushed a commit to peercoin/peercoin that referenced this issue Jan 18, 2023
If the user has unchecked "Allow incoming connections" in
`Settings->Options...->Network` then `fListen=false` is saved in
`~/.config/Bitcoin/Bitcoin-Qt.conf`. This flips `-listen` to `false`
during startup, but leaves `-listenonion` to `true`.

This flipping of `-listen` is done in `OptionsModel::Init()` after
`InitParameterInteraction()` has been executed which would have flipped
`-listenonion`, should it have seen `-listen` being `false`
(this is a difference between `bitcoind` and `bitcoin-qt`).

Fixes: bitcoin-core/gui#567

Github-Pull: bitcoin-core/gui#568
Rebased-From: 7f90dc26c8938f348938929b6d8bf1ea6f149209
@bitcoin-core bitcoin-core locked and limited conversation to collaborators Mar 23, 2023
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this issue Feb 20, 2024
… listening

7f90dc2 options: flip listenonion to false if not listening (Vasil Dimov)

Pull request description:

  If the user has unchecked "Allow incoming connections" in
  `Settings->Options...->Network` then `fListen=false` is saved in
  `~/.config/Bitcoin/Bitcoin-Qt.conf`. This flips `-listen` to `false`
  during startup, but leaves `-listenonion` to `true`.

  This flipping of `-listen` is done in `OptionsModel::Init()` after
  `InitParameterInteraction()` has been executed which would have flipped
  `-listenonion`, should it have seen `-listen` being `false`
  (this is a difference between `bitcoind` and `bitcoin-qt`).

  Fixes: bitcoin-core/gui#567

ACKs for top commit:
  mzumsande:
    Tested ACK 7f90dc2
  hebasto:
    ACK 7f90dc2
  jonatack:
    utACK 7f90dc2
  ryanofsky:
    Code review ACK 7f90dc2.

Tree-SHA512: ff5095096858eae696293dc58d1cd5bd1bb60ef7c5d07d87308a0cf71c67da88cc00b301b550704625f136c4ba3a29905a934a766535a6422fe85d9662299d32
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this issue Feb 21, 2024
… listening

7f90dc2 options: flip listenonion to false if not listening (Vasil Dimov)

Pull request description:

  If the user has unchecked "Allow incoming connections" in
  `Settings->Options...->Network` then `fListen=false` is saved in
  `~/.config/Bitcoin/Bitcoin-Qt.conf`. This flips `-listen` to `false`
  during startup, but leaves `-listenonion` to `true`.

  This flipping of `-listen` is done in `OptionsModel::Init()` after
  `InitParameterInteraction()` has been executed which would have flipped
  `-listenonion`, should it have seen `-listen` being `false`
  (this is a difference between `bitcoind` and `bitcoin-qt`).

  Fixes: bitcoin-core/gui#567

ACKs for top commit:
  mzumsande:
    Tested ACK 7f90dc2
  hebasto:
    ACK 7f90dc2
  jonatack:
    utACK 7f90dc2
  ryanofsky:
    Code review ACK 7f90dc2.

Tree-SHA512: ff5095096858eae696293dc58d1cd5bd1bb60ef7c5d07d87308a0cf71c67da88cc00b301b550704625f136c4ba3a29905a934a766535a6422fe85d9662299d32
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this issue Feb 23, 2024
… listening

7f90dc2 options: flip listenonion to false if not listening (Vasil Dimov)

Pull request description:

  If the user has unchecked "Allow incoming connections" in
  `Settings->Options...->Network` then `fListen=false` is saved in
  `~/.config/Bitcoin/Bitcoin-Qt.conf`. This flips `-listen` to `false`
  during startup, but leaves `-listenonion` to `true`.

  This flipping of `-listen` is done in `OptionsModel::Init()` after
  `InitParameterInteraction()` has been executed which would have flipped
  `-listenonion`, should it have seen `-listen` being `false`
  (this is a difference between `bitcoind` and `bitcoin-qt`).

  Fixes: bitcoin-core/gui#567

ACKs for top commit:
  mzumsande:
    Tested ACK 7f90dc2
  hebasto:
    ACK 7f90dc2
  jonatack:
    utACK 7f90dc2
  ryanofsky:
    Code review ACK 7f90dc2.

Tree-SHA512: ff5095096858eae696293dc58d1cd5bd1bb60ef7c5d07d87308a0cf71c67da88cc00b301b550704625f136c4ba3a29905a934a766535a6422fe85d9662299d32
@hebasto
Copy link
Member

hebasto commented Feb 24, 2024

Apparently, the bug still persist on Windows. Tested v26.1rc1:

image_2024-02-24_16-52-57

UPD. ... And on Linux (a regression?).

@hebasto hebasto reopened this Feb 24, 2024
@ryanofsky
Copy link
Contributor

Not sure what is causing this, but it looks like the original fix for this:

was removed in:

and replaced with a new fix:

gui/src/qt/optionsmodel.cpp

Lines 803 to 808 in 1ac627c

// 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,
// and other settings to default to false if it was set to false.
// (https://github.com/bitcoin-core/gui/issues/567).
node().initParameterInteraction();

I'm not sure why this is not working now, but I think I'd suggest opening a new bug with current steps to reproduce.

@vasild
Copy link
Contributor

vasild commented Feb 26, 2024

Opened bitcoin/bitcoin#29482 to track #567 (comment) which I believe is a different issue than the current one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
3 participants