-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Qt: Add network port input box to GUI settings #7107
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
Conversation
|
It's counterintuitive to most people that Bitcoin Core will refuse to use non-standard ports as anything but a last resort, does the option label need a GUI label or a confirmation popup to reflect this? I suspect a lot of people will be mystified otherwise that they don't get any incoming connections after changing a fairly innocuous looking option. |
src/qt/optionsdialog.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a better protection to not run into a startup termination if the user did enter a invalid port. IIRC the QIntValidator still allows one to enter 0 as port number which will very likely result in a locked Bitcoin-QT (startup will stop because of a invalid port). Haven't tested although.
Maybe check: #7025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably see 1-1023 as invalid as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tulip0 That is not universally true. I think Windows allows non-admin to bind them, and on Linux there are capabilities to allow binding them.
|
Concept ACK. We just need to make sure, people can only enter reasonable/valid ports. Because if someone enters port 80, bitcoin-qt is very likely "bricked" (unless he start with root permissions!) until he manages to startup Bitcoin-Qt with a override port setting (through a shell with `-port=8333' or by changing bitcoin.conf). Best would be to ask the user – during startup – if he likes to switch to the standard port if the given port can't be used (permissions or already used through another process). |
|
Thanks for the feedback @jonasschnelli, I'll work on the things you pointed out. |
|
@cocosoft Are you still working on this? |
|
@fanquake Yes, I do intend to continue working on this. |
|
Again, this needs a warning that users will get essentially no incoming connections if they change the port. It's not initiative behaviour and will cause significant confusion, I'm not convinced that this option should even be in a configuration window like this to begin with. The address rumouring system really can't be used in conjunction with anything but a single static port. |
|
Concept ACK. Agree that adding a warning (e.g. as mouseover) would make sense, and that ports should be restricted to valid ports (>1024 at least). |
|
Just FYI, I am still committed to this issue. I am still alive. @laanwj, agreed. |
|
@cocosoft I've addressed the port number concern, and modified NetworkStyle to store regtest settings separately from testnet. |
|
@luke-jr, great, thank you for your help! |
| if (settings.value("nNetworkPort") != value) { | ||
| // If the port input box is empty, set to default port | ||
| if (value.toString().isEmpty()) { | ||
| settings.setValue("nNetworkPort", (quint16)Params().GetDefaultPort()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm mistaken, but won't this code never be reached because of acc8f4e?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean because the empty field is invalid input? I suppose so.
|
Needs rebase. |
|
@ping Cocosoft. Are you interested to finish this? |
|
@jonasschnelli, I am interested in finishing this. I do understand however if you or someone else wants to take over because it has been idling for so long. I'll try to be on the IRC channel this week. |
Possibly in the case of the GUI it could be non-fatal if binding a port at startup fails. After warning the user there's no harm in continuing with the port closed. This would make this change a lot less dangerous. |
|
@cocosoft Are you still planning on finishing this? This needs a rebase at least. |
|
@fanquake Yes, I haven't forgotten about this and I still plan to continue, I just need to find time. I fully understand if someone wants to finish it up though, as it has been delayed for so long. |
|
Why did you add an enableOkButton and disableOkButton methods that are unused? |
|
I did not, actually you made them according to Git: $ git blame -L 227,227 src/qt/optionsdialog.cpp
578064a6 (Luke Dashjr 2016-02-12 20:08:00 +0000 227) void OptionsDialog::enableOkButton()I'll rebase again and fix that. Or did you merge the qtnetworkport branch to the master branch of Bitcoinknots? If that's the case, I maybe could just make a new commit removed the unused code. |
|
That code wasn't part of my commit; somehow it got added in when you rebased. Perhaps an accident during a merge? |
|
You're right, sorry. It seems like Philip Kaufman wrote the functions back in 2013: $ git blame -L 227,227 src/qt/optionsdialog.cpp
7e195e84 (Philip Kaufmann 2013-12-03 09:10:10 +0100 227) setOkButtonState(false); |
|
I'm not sure where the functions come from, I can confirm (by a backup) that they existed before the rebase I did. I'll remove them. Edit: Right, I had a merge conflict regarding the functions during the rebase. My bad! |
|
This needs a rebase. |
Adds Network port input box to the Network tab in the Options dialog. -port takes priority over the GUI setting. If left blank, it will default to the default port
bbc052a to
4396a3a
Compare
Lets you override an argument even if it has already been set, in contrast to SoftSetArg/SoftSetBoolArg.
If the port (specified by -port or GUI setting) is already in use when starting the GUI client, and it's not the standard port, ask the user if they want to listen via the standard network port instead.
a5819d7 to
1f37c87
Compare
|
As per @jonasschnelli suggestion, I added a Question box on startup to ask if the user wants to use the standard network port if the specified port (whether it's from -port or in GUI) is already in use. |
|
Needs rebase and nit fixes. |
|
Closing due to inactivity. Happy to reopen once this has made progress. |
Lets you override an argument even if it has already been set, in contrast to SoftSetArg/SoftSetBoolArg. Github-Pull: bitcoin#7107 Rebased-From: f5267bf
If the port (specified by -port or GUI setting) is already in use when starting the GUI client, and it's not the standard port, ask the user if they want to listen via the standard network port instead. Github-Pull: bitcoin#7107 Rebased-From: 1f37c87
Lets you override an argument even if it has already been set, in contrast to SoftSetArg/SoftSetBoolArg. Github-Pull: bitcoin#7107 Rebased-From: f5267bf
If the port (specified by -port or GUI setting) is already in use when starting the GUI client, and it's not the standard port, ask the user if they want to listen via the standard network port instead. Github-Pull: bitcoin#7107 Rebased-From: 1f37c87
|
Hi @jonasschnelli, I've rebased the branch upon master on cocosoft/bitcoin branch qtnetworkport. I added a warning prompt on startup if the user tries to use a non-standard port that is already in use, and gives the option to use the standard port. Best |
If the port (specified by -port or GUI setting) is already in use when starting the GUI client, and it's not the standard port, ask the user if they want to listen via the standard network port instead. Github-Pull: bitcoin#7107 Rebased-From: 1f37c87
If the port (specified by -port or GUI setting) is already in use when starting the GUI client, and it's not the standard port, ask the user if they want to listen via the standard network port instead. Github-Pull: bitcoin#7107 Rebased-From: 1f37c87
If the port (specified by -port or GUI setting) is already in use when starting the GUI client, and it's not the standard port, ask the user if they want to listen via the standard network port instead. Github-Pull: bitcoin#7107 Rebased-From: 1f37c87
If the port (specified by -port or GUI setting) is already in use when starting the GUI client, and it's not the standard port, ask the user if they want to listen via the standard network port instead. Github-Pull: bitcoin#7107 Rebased-From: 1f37c87
If the port (specified by -port or GUI setting) is already in use when starting the GUI client, and it's not the standard port, ask the user if they want to listen via the standard network port instead. Github-Pull: bitcoin#7107 Rebased-From: 1f37c87
If the port (specified by -port or GUI setting) is already in use when starting the GUI client, and it's not the standard port, ask the user if they want to listen via the standard network port instead. Github-Pull: bitcoin#7107 Rebased-From: 1f37c87
If the port (specified by -port or GUI setting) is already in use when starting the GUI client, and it's not the standard port, ask the user if they want to listen via the standard network port instead. Github-Pull: bitcoin#7107 Rebased-From: 1f37c87
If the port (specified by -port or GUI setting) is already in use when starting the GUI client, and it's not the standard port, ask the user if they want to listen via the standard network port instead. Github-Pull: bitcoin#7107 Rebased-From: 1f37c87
Related issue #7039