#27409 Make GUI and CLI tools use the same datadir

full analysis

https://github.com/bitcoin/bitcoin/pull/27409 · ryanofsky · +465/-103 in 13 files, 3 commits · labels: Needs rebase · draft

Goal

  • Ensure CLI tools automatically use the custom data directory selected in the GUI
  • Prevent tools from downloading blocks to the wrong location or missing user wallets

This pull request aligns datadir resolution between the GUI and CLI tools. When a user selects a custom datadir in the GUI intro dialog, a symlink or pointer file is written to the default datadir path so CLI tools and bitcoind automatically resolve the same directory. Additionally, bitcoin-wallet is updated to load bitcoin.conf on initialization.

Problem: Selecting a non-default data directory in the GUI stores the setting in GUI-specific storage (e.g. QSettings) which CLI tools ignore. Users running bitcoind or bitcoin-cli without an explicit -datadir argument end up referencing the default location, leading to duplicate block downloads, missing wallets, or confusing errors.

Category: Tools and scripts (#4 of 22)

P3 · cleanup

  • P3 because bitcoin-wallet ignores configuration files placed in the custom datadir
  • Brings bitcoin-wallet configuration handling into parity with other CLI binaries

P3 because it ensures the bitcoin-wallet tool reads bitcoin.conf like other utilities, eliminating unexpected differences when operating on a custom datadir.

Membership: Modifies src/bitcoin-wallet.cpp to parse configuration files.

Factors: security/stability 0, bug 1, performance 0, user value 2, leverage 1

Category: Utilities (logging, arguments, libraries) (#8 of 66)

P3 · user request

  • P3 because it fixes a configuration trap where CLI tools diverge from GUI settings
  • Stops bitcoind and CLI tools from defaulting to the wrong datadir and missing wallets

P3 because resolving the divergence between GUI and CLI datadirs addresses a known pain point (#8106) where users running CLI commands inadvertently target the wrong chainstate or wallet directories.

Membership: Modifies ArgsManager and common config initialization routines in src/common/args.cpp, src/common/config.cpp, and src/common/init.cpp.

Factors: security/stability 0, bug 1, performance 0, user value 2, leverage 1

Reviewability: Paused: Author reworking

  • Author stated it is not ready while working on complex Qt tests
  • PR is currently marked draft and needs a rebase

The author explicitly stated the PR is not ready for review and lacks necessary tests for directory permutations, alongside having active merge conflicts.

Author status: silent since 2025-10-15 force push; previously stated PR is not ready and author was struggling with test permutations

Open concerns:

  • Functional test logic around Windows directory retrieval was reported broken by pinheadmz
  • Author noted difficulty covering all configuration and directory presence permutations in Qt tests

Resolved concerns:

  • luke-jr questioned whether bitcoin.conf placement in GUI-selected datadir would break, but clarified it was only an initial reaction to the description and not an identified code issue

Agreement: Mild

  • Positive concept feedback on resolving long-standing datadir divergence
  • Welcomed as closing issue 8106 (pinheadmz)
  • Clarified that custom datadir config files are still loaded properly (luke-jr)

Mild: pinheadmz confirmed a Windows test issue that remains unaddressed, while concept has general support

The concept of unifying GUI and CLI datadir handling has general interest and no philosophical opposition, but technical hurdles on Windows remain open and the author has put work on hold.

  • pinheadmz: 'This PR probably closes https://github.com/bitcoin/bitcoin/issues/8106'
  • pinheadmz: 'Confirmed, doesn't work :-( https://learn.microsoft.com/en-us/windows/win32/shell/csidl#remarks'

Objections:

ReviewerKindHarmStatusBlockingAuthor repliedQuote
pinheadmzcorrectnessWindows shell CSIDL functionality failed in test_config_argsopennono2023-10-03: 'Confirmed, doesn't work :-('

Support:

  • pinheadmz: Resolves long-standing issue #8106 regarding GUI and bitcoind datadir sharing

Participants: pinheadmz (objection), luke-jr (question), maflcko (question)

State derived from the lists: nonblocking objection open (pinheadmz)

Review verdicts (DrahtBot): 0

Files

12 lines under test/bench/ci.

  • src/qt/intro.cpp +282/-40
  • src/common/config.cpp +127/-13
  • src/common/init.cpp +9/-21
  • src/common/args.h +17/-1
  • src/qt/bitcoin.cpp +9/-3
  • src/common/args.cpp +1/-10
  • src/qt/optionsmodel.cpp +0/-11
  • src/test/argsman_tests.cpp +5/-0
  • src/test/util/setup_common.cpp +4/-1
  • src/bitcoin-wallet.cpp +4/-0
  • src/common/init.h +3/-1
  • src/qt/intro.h +3/-1
  • test/functional/tool_wallet.py +1/-1

Card

PR 27409 unifies datadir handling across GUI and CLI tools by creating a symlink or pointer file at the default datadir path when a custom directory is chosen in the GUI intro screen. This solves a longstanding issue where CLI tools like bitcoind or bitcoin-cli inadvertently fall back to ~/.bitcoin instead of the GUI-configured directory. While the concept is welcomed, the author paused work due to the complexity of testing numerous datadir permutation states across platforms, and the branch currently requires a rebase.

Data

dossier JSON · extract JSON · model openrouter/google/gemini-3.8-flash, generated 2026-09-17T21:16, confidence high, input hash 6aa72428f21d56d6