Skip to content

gui: warn when config file not found at custom datadir path#286

Open
Bortlesboat wants to merge 2 commits into
bitcoinknots:29.x-knotsfrom
Bortlesboat:gui-warn-missing-config
Open

gui: warn when config file not found at custom datadir path#286
Bortlesboat wants to merge 2 commits into
bitcoinknots:29.x-knotsfrom
Bortlesboat:gui-warn-missing-config

Conversation

@Bortlesboat

Copy link
Copy Markdown

When a custom datadir is set via the GUI, bitcoin.conf is resolved relative to that directory. If the user's config file lives at the default data directory (as is common), it gets silently ignored — no error, no log message, nothing to indicate why settings aren't being applied.

This adds a LogWarning when the default config file path doesn't exist and -noconf wasn't set, so the issue shows up in debug.log.

Fixes #282

When a custom datadir is set via the GUI, bitcoin.conf is looked up
relative to that directory instead of the default data directory. If the
file doesn't exist there, settings are silently ignored with no
indication in the log.

Add a LogWarning when the resolved default config path doesn't exist and
-conf was not explicitly set, so that users can diagnose why their
bitcoin.conf settings aren't being applied.
Comment thread src/common/config.cpp Outdated
// which can happen when a custom datadir moves the base path away from
// the default location where the user's bitcoin.conf actually lives.
if (!IsArgSet("-conf") && !stream.good()) {
LogWarning("Config file %s not found; settings from it will not be applied. "

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: it is redundant to say that settings won't be applied from a file that cannot be found. Consider the following revision:

Config file %s doesn't exist or cannot be read; no settings will be applied.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point — "doesn't exist or cannot be read" is more precise since !stream.good() can also fail on permission issues, not just a missing file. Updated the first part.

I kept the second sentence though — without it the user just gets told something's wrong with no idea what to do about it. The -conf hint especially is worth keeping since that's the actual fix for this scenario.

Dropped the "settings from it will not be applied" bit since as you said that's implied.

Use "doesn't exist or cannot be read" instead of "not found" to
more precisely describe the !stream.good() failure modes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

txindex=1 in bitcoin.conf silently ignored by Qt GUI — must also be in settings.json

4 participants