Is there an existing issue for this?
- Similar questions was raised in #15745 but it is marked as “solved” and closed.
Current behaviour
Registry has a REG_SZ key HKEY_CURRENT_USER\SOFTWARE\Bitcoin\Bitcoin-Qt\strDataDir
(and there can be Bitcoin-Qt-regtest\strDataDir, Bitcoin-Qt-testnet\strDataDir for test chains).
It is created by default when bitcoin-qt starts first time and after editing/accepting first start wizard.
Change database directory to non-default path, put there bitcoin.conf with datadir=databasepath and run bitcoin-qt (-cli/etc) and bitcoin ignores datadir path if no -datadir argument passed to a program exclusively.
The same problem with the blocksdir parameter.
Expected behaviour
In all situations behavior must be identical - if we start without arguments or pass “-conf” then use .conf “datadir=path” (according to sections [main], [regtest], [test] or global if there are no sections) if .conf exists and datadir are there. Now it is ignored. If we start with “-datadir=path” argument it’s works.
Steps to reproduce
- For example, change
HKEY_CURRENT_USER\SOFTWARE\Bitcoin\Bitcoin-Qt\strDataDir
toW:\BitcoinCore\strDataDir
(assuming our disk is W: and all paths in this example exists). - Create W:\BitcoinCore\strDataDir\bitcoin.conf with three lines:
datadir=W:/BitcoinCore/DataDir/main1 [main] datadir=W:/BitcoinCore/DataDir/main2
- Start
bitcoin-qt.exe -debuglogfile=W:/BitcoinCore/debug.no_params.log
- After a few seconds close opened wallet (bitcoin-qt) [Alt-F4].
- Start
bitcoin-qt.exe -datadir=W:\BitcoinCore\DataDir\main -debuglogfile=W:\BitcoinCore\debug.w_datadir_param.log
- After a few seconds close opened wallet (bitcoin-qt) [Alt-F4].
- Start
bitcoin-qt.exe -conf=W:\BitcoinCore\strDataDir\bitcoin.conf -debuglogfile=W:\BitcoinCore\debug.w_conf_param.log
- After a few seconds close opened wallet (bitcoin-qt) [Alt-F4].
- Check filesystem and logs (attached).
I’ve used Sysinternals Process Monitor to dig what’s happening.
Relevant log output
debug.no_params.log:
Default data directory C:\Users\USERNAME\AppData\Roaming\Bitcoin Using data directory W:\BitcoinCore\strDataDir Config file: W:\BitcoinCore\strDataDir\bitcoin.conf Config file arg: datadir=“W:/BitcoinCore/DataDir/main1” Config file arg: [main] datadir=“W:/BitcoinCore/DataDir/main2” Creating peers.dat because the file was not found (“W:\BitcoinCore\strDataDir\peers.dat”) Opening LevelDB in W:\BitcoinCore\strDataDir\blocks\index Opening LevelDB in W:\BitcoinCore\strDataDir\chainstate
debug.w_datadir_param.log:
Default data directory C:\Users\USERNAME\AppData\Roaming\Bitcoin Using data directory W:\BitcoinCore\DataDir\main Config file: W:\BitcoinCore\DataDir\main\bitcoin.conf (not found, skipping) Command-line arg: datadir=“W:\\BitcoinCore\\DataDir\\main” Opening LevelDB in W:\BitcoinCore\\DataDir\main\blocks\index Opening LevelDB in W:\BitcoinCore\DataDir\main\chainstate
debug.w_conf_param.log output is identical to debug.no_params.log.
How did you obtain Bitcoin Core
- Downloaded from bitcoincore.org/bin
- Compiled from source
What version of Bitcoin Core are you using?
24.0.1
Operating system and version
Win 10 x64
Machine specifications
Non relevant