forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make GUI and CLI tools use the same datadir
Currently if a you choose a non-default datadir in the GUI intro screen, the datadir is ignored by CLI tools. This means `bitcoin-cli` and `bitcoin-wallet` will try to use the wrong datadir and show errors if they are called without a -datadir arguments, and `bitcoind` will appear to work but use a different datadir, not loading the same wallets and settings, and downloading blocks into the wrong place. There are also more subtle inconsistencies between GUI and CLI selection of datadirs such as bitcoin#27273 where GUI might ignore a datadir= line in a bitcoin.conf that CLI tools would apply. This PR gets rid of inconsistencies between GUI and CLI tools and makes them use the same datadir setting by default. It is followup to bitcoin-core/gui#602 which made GUI and CLI tools use the same `-dbcache`, `-par`, `-spendzeroconfchange`, `-signer`, `-upnp`, `-natpmp`, `-listen`, `-server`, `-prune`, `-proxy`, `-onion`, and `-lang` settings as long as they loaded the same datadir. The reason for GUI and CLI tools using inconsistent datadirs, is that GUI stores the datadir path in a `strDataDir` field in `.config/Bitcoin/Bitcoin-Qt.conf`[^1] which CLI tools ignore. This PR changes the GUI to instead store the datadir path at the default datadir location `~/.bitcoin`[^2] as a symlink that CLI tools will already follow, or as a text file if the filesystem does not support creating symlinks. If upgrading from a previous version of the GUI and there is only a GUI datadir, the `strDataDir` setting will be automatically migrated to a symlink so CLI tools will start using it as well. If CLI and GUI tools are currently using different default datadirs, the GUI will show a prompt allowing either of the datadirs to be loaded and optionally set as the common default going forward.
- Loading branch information
Showing
8 changed files
with
276 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.