Testnet configuration is ignored. #21154

issue beirut-boop opened this issue on February 11, 2021
  1. beirut-boop commented at 3:59 PM on February 11, 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.:

        /// 3. Application identification
        // must be set before OptionsModel is initialized or translations are loaded,
        // as it is used to locate QSettings
        QApplication::setOrganizationName(QAPP_ORG_NAME);
        QApplication::setOrganizationDomain(QAPP_ORG_DOMAIN);
    -    QApplication::setApplicationName(QAPP_APP_NAME_DEFAULT);
    +    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 11, 2021
  3. hebasto commented at 5:16 AM on February 17, 2021: member

    @beirut-boop Do you mind opening this issue in the dedicated https://github.com/bitcoin-core/gui/issues repo, and closing it here?

  4. beirut-boop commented at 12:12 AM on February 19, 2021: none
  5. beirut-boop closed this on Feb 19, 2021

  6. DrahtBot locked this on Aug 18, 2022
Contributors
Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-16 06:14 UTC

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