{
 "number": 27409,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/27409",
 "title": "Make GUI and CLI tools use the same datadir",
 "author": "ryanofsky",
 "author_association": "CONTRIBUTOR",
 "created_at": "2023-04-03T16:21:47Z",
 "updated_at": "2026-07-16T01:21:40Z",
 "age_days": 1262,
 "draft": true,
 "labels": [
  "Needs rebase"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "58645699229fcb2ebb7ff51b58239fa73937f91c",
 "head_ref": "pr/1data",
 "head_repo": "ryanofsky/bitcoin",
 "head_history": [
  {
   "t": "2023-04-12T15:16:19Z",
   "sha": "5855150efae74d10e0eaf3bd08b06e8655a0f1ba"
  },
  {
   "t": "2025-10-15T00:41:54Z",
   "sha": "58645699229fcb2ebb7ff51b58239fa73937f91c"
  }
 ],
 "additions": 465,
 "deletions": 103,
 "changed_files": 13,
 "commit_count": 3,
 "size_bucket": "L",
 "mergeable_state": "dirty",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {},
   "conflicts": [
    {
     "number": 33550,
     "title": "Fix windows libc++ `fs::path` `fstream` compile errors",
     "author": "ryanofsky"
    },
    {
     "number": 31260,
     "title": "scripted-diff: Type-safe settings retrieval",
     "author": "ryanofsky"
    }
   ]
  }
 },
 "acks_parsed": {},
 "acks_tally": {
  "ack": 0,
  "stale_ack": 0,
  "concept_ack": 0,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "luke-jr",
   "maflcko",
   "pinheadmz"
  ]
 },
 "signals": {
  "needs_rebase": true,
  "ci_failed": false,
  "mergeable_state": "dirty",
  "last_author_activity": "2025-10-15T00:41:54Z",
  "last_reviewer_activity": "2024-06-28T09:16:19Z",
  "last_reviewer": "maflcko",
  "author_silent_days": 337,
  "waiting_on_author_days": 0,
  "days_since_update": 63
 },
 "refs": {
  "mentioned": [
   27273,
   27302
  ],
  "depends_on": [
   27302
  ],
  "fixes": [],
  "linked_issues": [],
  "references": [
   {
    "number": 27302,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2023-05-26",
    "title": "init: Error if ignored bitcoin.conf file is found"
   },
   {
    "number": 27273,
    "type": "pull",
    "state": "closed",
    "merged": false,
    "merged_at": null,
    "title": "system: allow GUI to initialize default data dir"
   }
  ],
  "conflicts": [
   33550,
   31260
  ]
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [
  "test/functional/feature_config_args.py"
 ],
 "body": "**This is based on #27302.** The non-base commits are:\n\n- [`ae5fc323b24` bitcoin-wallet: make bitcoin-wallet tool load config file](https://github.com/bitcoin/bitcoin/pull/27409/commits/ae5fc323b2441bc45c38737f1ffb40d777b134d8)\n- [`b091d9b0762` init: Allow bitcoin default datadir to point at an external datadir](https://github.com/bitcoin/bitcoin/pull/27409/commits/b091d9b076204f69cc814353139d5bf0df412bae)\n- [`5855150efae` Make GUI and CLI tools use the same datadir](https://github.com/bitcoin/bitcoin/pull/27409/commits/5855150efae74d10e0eaf3bd08b06e8655a0f1ba)\n\n---\n\nCurrently if your choose a non-default datadir in the GUI intro screen, the datadir is ignored by CLI tools.\n\nThis PR makes GUI and CLI tools the same datadir setting by default. It is followup to https://github.com/bitcoin-core/gui/pull/602 which made GUI and CLI tools use the same settings as long as they loaded the same datadir.\n\nThe reason GUI and CLI tools use 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 symlinks.\n\nIf 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.\n\nIf upgrading and GUI and CLI tools are using different datadirs, the GUI will show a prompt allowing either of the datadirs to be loaded on startup, with an option to set one as the default going forward.\n\n[^1]: `strDataDir` value is stored in `.config/Bitcoin/Bitcoin-Qt.conf` on linux, in property list files on macos, and in registry keys on windows.\n[^2]: The default datadir location is `~/.bitcoin` on linux, `~/Library/Application Support/Bitcoin` on macos, and `%APPDATA%\\Bitcoin` on windows",
 "commits": [
  {
   "sha": "0545d0d890bd84d392d1d6e8755ddbab8b05ea70",
   "date": "2025-10-10T19:52:00Z",
   "message": "bitcoin-wallet: make bitcoin-wallet tool load config file\n\nCurrently bitcoin-wallet accepts a -datadir argument but ignores and config\nfile in that directory. This changes it to load the config file for consistency\nwith other cli tools, and in case it contains any significant settings.\n\nAlso update various tests using the data directory to call ReadConfigFiles.\n\nMotivation for these changes is to prevent errors after the next commit makes\nit at assert error to get the datadir path without reading the configuration\nfirst."
  },
  {
   "sha": "636cc9aff5cc331312c5821841ca5d43ed6b60d6",
   "date": "2025-10-10T19:52:00Z",
   "message": "init: Allow bitcoin default datadir to point at an external datadir\n\nIt's always been possible for bitcoin default datadirs ($HOME/.bitcoin,\n$HOME/Library/Application Support/Bitcoin, %APPDATA%\\Bitcoin) to point at an\nexternal locations using symlinks, but not all filesystems support symlinks, so\nadd extra support for pointing at external locations using text file.\n\nThis feature is used in the following commit to allow the bitcoin GUI to select\na default datadir location that will also be treated as the default datadir for\nCLI tools. Currently when a custom data is set in the GUI, CLI tools ignore it\nby default."
  },
  {
   "sha": "58645699229fcb2ebb7ff51b58239fa73937f91c",
   "date": "2025-10-10T19:52:00Z",
   "message": "Make GUI and CLI tools use the same datadir\n\nCurrently if a you choose a non-default datadir in the GUI intro screen, the\ndatadir is ignored by CLI tools. This means `bitcoin-cli` and `bitcoin-wallet`\nwill try to use the wrong datadir and show errors if they are called without a\n-datadir arguments, and `bitcoind` will appear to work but use a different\ndatadir, not loading the same wallets and settings, and downloading blocks into\nthe wrong place.\n\nThere are also more subtle inconsistencies between GUI and CLI selection of\ndatadirs such as #27273 where GUI might ignore a datadir= line in a\nbitcoin.conf that CLI tools would apply.\n\nThis PR gets rid of inconsistencies between GUI and CLI tools and makes them\nuse the same datadir setting by default. It is followup to\nhttps://github.com/bitcoin-core/gui/pull/602 which made GUI and CLI tools use\nthe same `-dbcache`, `-par`, `-spendzeroconfchange`, `-signer`, `-upnp`,\n`-natpmp`, `-listen`, `-server`, `-prune`, `-proxy`, `-onion`, and `-lang`\nsettings as long as they loaded the same datadir.\n\nThe reason for GUI and CLI tools using inconsistent datadirs, is that GUI\nstores the datadir path in a `strDataDir` field in\n`.config/Bitcoin/Bitcoin-Qt.conf`[^1] which CLI tools ignore. This PR changes\nthe GUI to instead store the datadir path at the default datadir location\n`~/.bitcoin`[^2] as a symlink that CLI tools will already follow, or as a text\nfile if the filesystem does not support creating symlinks.\n\nIf upgrading from a previous version of the GUI and there is only a GUI\ndatadir, the `strDataDir` setting will be automatically migrated to a symlink\nso CLI tools will start using it as well. If CLI and GUI tools are currently\nusing different default datadirs, the GUI will show a prompt allowing either of\nthe datadirs to be loaded and optionally set as the common default going\nforward."
  }
 ],
 "timeline": [
  {
   "t": "2023-04-03T16:22:49Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "CONTRIBUTOR",
   "text": "This is a draft PR and not fully implemented. Just opening it to share progress since it's taking longer than I expected to implement correctly"
  },
  {
   "t": "2023-04-12T15:16:19Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "5855150efae74d10e0eaf3bd08b06e8655a0f1ba"
  },
  {
   "t": "2023-04-15T11:21:27Z",
   "kind": "comment",
   "who": "pinheadmz",
   "assoc": "MEMBER",
   "text": "This PR probably closes https://github.com/bitcoin/bitcoin/issues/8106"
  },
  {
   "t": "2023-06-22T22:21:24Z",
   "kind": "comment",
   "who": "luke-jr",
   "assoc": "MEMBER",
   "text": "Won't this change/break putting the bitcoin.conf in the GUI-selected datadir?"
  },
  {
   "t": "2023-06-22T22:36:38Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "CONTRIBUTOR",
   "text": "[quoted text omitted]\n\nNo, I definitely need to update this and it may contain bugs. But do you see something here that would cause that to happen?"
  },
  {
   "t": "2023-06-22T23:02:04Z",
   "kind": "comment",
   "who": "luke-jr",
   "assoc": "MEMBER",
   "text": "No, I didn't get to the code yet - was just commenting from the description of this PR and #27302"
  },
  {
   "t": "2023-10-03T12:17:36Z",
   "kind": "review_comment",
   "who": "pinheadmz",
   "assoc": "MEMBER",
   "path": "test/functional/feature_config_args.py",
   "commit": "5855150efae74d10e0eaf3bd08b06e8655a0f1ba",
   "in_reply_to": null,
   "text": "Confirmed, doesn't work :-(\nhttps://learn.microsoft.com/en-us/windows/win32/shell/csidl#remarks"
  },
  {
   "t": "2024-06-28T09:16:19Z",
   "kind": "comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "text": "@ryanofsky What is the status of this?"
  },
  {
   "t": "2024-06-28T14:34:50Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "CONTRIBUTOR",
   "text": "re: https://github.com/bitcoin/bitcoin/pull/27409#issuecomment-2196478179\n\n[quoted text omitted]\nIt's a change I'd really like to get back to, but is not ready now. The last time I worked on it, which was months ago, I started writing a Qt test for it but there are so many permutations of configurations (presence/absense of different data directory locations) that I was struggling to write it. I would like to get back to this at some point and I do have work in progress, but I don't think I will have an update on it soon, given other things I'm working on.\n\n---\n\nRebased 5855150efae74d10e0eaf3bd08b06e8655a0f1ba -> 58645699229fcb2ebb7ff51b58239fa73937f91c ([`pr/1data.2`](https://github.com/ryanofsky/bitcoin/commits/pr/1data.2) -> [`pr/1data.3`](https://github.com/ryanofsky/bitcoin/commits/pr/1data.3), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/1data.2-rebase..pr/1data.3))"
  },
  {
   "t": "2025-10-15T00:41:54Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "58645699229fcb2ebb7ff51b58239fa73937f91c"
  }
 ],
 "labels_log": [
  {
   "t": "2023-04-03T18:17:56Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2023-04-12T15:37:30Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2023-04-21T10:23:47Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-10-15T00:57:45Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-10-22T10:16:48Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  }
 ],
 "state_log": [],
 "text_chars": 6622,
 "text_tokens_estimate": 1655,
 "changed_paths": [
  "src/bitcoin-wallet.cpp",
  "src/common/args.cpp",
  "src/common/args.h",
  "src/common/config.cpp",
  "src/common/init.cpp",
  "src/common/init.h",
  "src/qt/bitcoin.cpp",
  "src/qt/intro.cpp",
  "src/qt/intro.h",
  "src/qt/optionsmodel.cpp",
  "src/test/argsman_tests.cpp",
  "src/test/util/setup_common.cpp",
  "test/functional/tool_wallet.py"
 ],
 "files": [
  {
   "path": "src/bitcoin-wallet.cpp",
   "add": 4,
   "del": 0
  },
  {
   "path": "src/common/args.cpp",
   "add": 1,
   "del": 10
  },
  {
   "path": "src/common/args.h",
   "add": 17,
   "del": 1
  },
  {
   "path": "src/common/config.cpp",
   "add": 127,
   "del": 13
  },
  {
   "path": "src/common/init.cpp",
   "add": 9,
   "del": 21
  },
  {
   "path": "src/common/init.h",
   "add": 3,
   "del": 1
  },
  {
   "path": "src/qt/bitcoin.cpp",
   "add": 9,
   "del": 3
  },
  {
   "path": "src/qt/intro.cpp",
   "add": 282,
   "del": 40
  },
  {
   "path": "src/qt/intro.h",
   "add": 3,
   "del": 1
  },
  {
   "path": "src/qt/optionsmodel.cpp",
   "add": 0,
   "del": 11
  },
  {
   "path": "src/test/argsman_tests.cpp",
   "add": 5,
   "del": 0
  },
  {
   "path": "src/test/util/setup_common.cpp",
   "add": 4,
   "del": 1
  },
  {
   "path": "test/functional/tool_wallet.py",
   "add": 1,
   "del": 1
  }
 ],
 "test_lines": 12,
 "git": {
  "head": "58645699229fcb2ebb7ff51b58239fa73937f91c",
  "head_matches_backup": true,
  "base": "d2987102dd13f965c7a0bf1d5b8ee15bcf025398",
  "commits": [
   {
    "sha": "0545d0d890",
    "subject": "bitcoin-wallet: make bitcoin-wallet tool load config file",
    "files": 4,
    "add": 14,
    "del": 2
   },
   {
    "sha": "636cc9aff5",
    "subject": "init: Allow bitcoin default datadir to point at an external datadir",
    "files": 4,
    "add": 102,
    "del": 28
   },
   {
    "sha": "5864569922",
    "subject": "Make GUI and CLI tools use the same datadir",
    "files": 8,
    "add": 367,
    "del": 91
   }
  ],
  "patch_truncated": true
 },
 "input_hash": "6aa72428f21d56d6",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}