Catch invalid networks combination crash #690
pull furszy wants to merge 1 commits into bitcoin-core:master from furszy:2022_gui_catch_netparam_crash changing 1 files +16 −15-
furszy commented at 2:12 pm on December 26, 2022: memberThe app currently crashes if a network is set inside bitcoin.conf and another one is provided as param. The reason is an uncaught runtime_error.
-
gui: bugfix, catch invalid networks combination crash
We shouldn't crash if a network is set inside bitcoin.conf and another one is provided as param.
-
DrahtBot commented at 2:12 pm on December 26, 2022: contributor
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Reviews
See the guideline for information on the review process.
Type Reviewers ACK jarolrod, johnny9, john-moffett, pablomartin4btc, hebasto Concept ACK hernanmarino If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
-
jarolrod approved
-
jarolrod commented at 0:21 am on December 29, 2022: member
tACK f4a11d7baf79ff6929d9ba8a934f53c4c7eb7c8e
Reproduced the crash on master by passing in a chain param while my bitcoin.conf specified a different chain:
master
0libc++abi: terminating with uncaught exception of type std::runtime_error: Invalid combination of -regtest, -signet, -testnet and -chain. Can use at most one. 1[1] 53813 abort ./src/qt/bitcoin-qt -signet
The PR branch fixes the issue for me:
pr
0Error: Invalid combination of -regtest, -signet, -testnet and -chain. Can use at most one.
Also tested the scenario where we show the intro to choose a datadir and a network parameter is passed; crash on master, fixed in pr branch.
-
johnny9 approved
-
johnny9 commented at 0:54 am on December 29, 2022: contributor
tACK f4a11d7baf79ff6929d9ba8a934f53c4c7eb7c8e
Tested the changes with the following method.
- Set bitcoin.conf to testnet
0// /home/user/.bitcoin/bitcoin.conf 1testnet=1
- ran bitcoin-qt with the following command
bitcoin-qt -signet
On masterr (e9262ea32a6e1d364fb7974844fadc36f931f8c6):
0~/github/gui$ ./src/qt/bitcoin-qt -signet 1Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. 2terminate called after throwing an instance of 'std::runtime_error' 3 what(): Invalid combination of -regtest, -signet, -testnet and -chain. Can use at most one. 4Aborted (core dumped)
With PR (f4a11d7baf79ff6929d9ba8a934f53c4c7eb7c8e):
0~/github/gui$ ./src/qt/bitcoin-qt -signet 1Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. 2Error: Invalid combination of -regtest, -signet, -testnet and -chain. Can use at most one.
And the following error dialog also appears now:
The change expands the try block to handle the exception thrown from GetChainName and is a reasonable approach to handling the error and giving the user expected gui error dialog. Some follow up to this bug might include functional test coverage with the settings testcases to prevent regression. Another possible follow up is to handle the exception within ReadConfigFiles so bitcoind doesn’t abort from the runtime_error.
-
hernanmarino commented at 3:35 am on December 29, 2022: contributorTested ACK. Also fails on master and succeds on PR.
-
jarolrod added the label Bug on Jan 3, 2023
-
john-moffett approved
-
john-moffett commented at 2:35 pm on January 5, 2023: contributorACK f4a11d7baf79ff6929d9ba8a934f53c4c7eb7c8e
-
pablomartin4btc approved
-
pablomartin4btc commented at 6:59 pm on January 5, 2023: contributorTested ACK f4a11d7baf79ff6929d9ba8a934f53c4c7eb7c8e. It behaves as expected, tested using different networks before and after the fix. I agree with @johnny9 on functional tests if possible as a follow up ofc.
-
hebasto approved
-
hebasto commented at 6:39 pm on January 15, 2023: memberACK f4a11d7baf79ff6929d9ba8a934f53c4c7eb7c8e, tested on Ubuntu 22.04 (Qt 5.15.3).
-
hebasto renamed this:
bugfix, catch invalid networks combination crash
Catch invalid networks combination crash
on Jan 15, 2023 -
hebasto merged this on Jan 15, 2023
-
hebasto closed this on Jan 15, 2023
-
sidhujag referenced this in commit 64584341bc on Jan 16, 2023
-
bitcoin-core locked this on Jan 15, 2024
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: 2024-11-23 07:20 UTC
More mirrored repositories can be found on mirror.b10c.me