Testnet configuration is ignored #212

issue beirut-boop openend this issue on February 19, 2021
  1. beirut-boop commented at 0:11 am on February 19, 2021: none

    Running bitcoin-qt.exe -testnet creates a separate testnet QSettings called Bitcoin-Qt-testnet. I assume this was done on purpose, so you can easily run testnet settings in parallel to mainnet.

    Expected behavior

    Changing settings in the Bitcoin-Qt-testnet QSettings should be reflected in the Qt wallet when running with -testnet.

    For example, on Windows the QSettings are stored in the registry. The testnet key is here:

    image

    Actual behavior

    The Bitcoin-Qt-testnet settings are ignored, and Bitcoin-Qt mainnet settings are used in stead.

    To reproduce

    On a clean system, start the wallet for the first time in -testnet mode. In the start wizard, change any option (e.g. the path). Observe how all defaults are written to Bitcoin-Qt-testnet, but the updated settings are written to the (previously empty) Bitcoin-Qt QSettings:

    image

    What is happening

    It appears as if during the initialization of the app (while writing default settings), the appName (and QSettings based on appName) is still QAPP_APP_NAME_TESTNET. Yet later (when reading the settings) the app name changed to QAPP_APP_NAME_DEFAULT.

    What causes this

    Perhaps because here the appName is set to QAPP_APP_NAME_DEFAULT: https://github.com/bitcoin/bitcoin/blob/8e1913ae025ad8912457abe24ae5c61da02fc17a/src/qt/bitcoin.cpp#L496-L501

    Rather than the one from the test NetworkStyle: https://github.com/bitcoin/bitcoin/blob/8e1913ae025ad8912457abe24ae5c61da02fc17a/src/qt/networkstyle.cpp#L14-L24

    Perhaps it would work as intended if we would use the NetworkStyle app name. E.g.:

    0    /// 3. Application identification
    1    // must be set before OptionsModel is initialized or translations are loaded,
    2    // as it is used to locate QSettings
    3    QApplication::setOrganizationName(QAPP_ORG_NAME);
    4    QApplication::setOrganizationDomain(QAPP_ORG_DOMAIN);
    5-    QApplication::setApplicationName(QAPP_APP_NAME_DEFAULT);
    6+    QApplication::setApplicationName(networkStyle->getAppName());
    

    System information

    Windows 10 Bitcoin 0.21 precompiled

    Extra info

    It is possible that the intended behavior was never finished and forgotten, or it was never intended to work the way I am assuming.

    Originally found on Syscoin here: https://github.com/syscoin/syscoin/issues/417

  2. beirut-boop added the label Bug on Feb 19, 2021
  3. jarolrod commented at 3:55 pm on February 19, 2021: member

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: 2024-12-03 17:20 UTC

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