-
Notifications
You must be signed in to change notification settings - Fork 37.7k
[qt] move QSettings to bitcoin_rw.conf where possible #12833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Please, never write to |
@laanwj two files is indeed what @luke-jr did, but I don't see how that changes anything. It's critical that Also note that only QT needs this ability, so I could refactor it such that I thought of a completely different approach to handle the |
One thing is permissions. The data directory is guaranteed writable. The configuration file might be
Unlike QSettings the second file would be used by both the GUI and the daemon. And it might be useful to edit settings in bitcoind at real-time as well. The GUI shouldn't really be special there, that gets in the way of the whole idea of unifying the settings mechanism. |
If
Indeed. I thought having two separate files leads to a more complicated implementation than just having one, but I didn't remove that much from the original code so far. It helps that settings can be overridden by repeating them in the new file. So in that case it might more sense to get #11082 merged, in which case this PR just adds QSettings migration code on top of that. |
3f4d27f
to
518f630
Compare
I pushed a new version that uses |
I'm not sure if moving the QT settings from pure QT format in the QT chosen file to the bitcoind compatible I also think we could expose prune to the QT layer without sharing the configuration value with bitcoind. Users using bitcoind & QT with the same settings and datadir do probably know the ramification of GUI only settings. A warning when enabling prune in QT (once implemented) that it will not automatically be enabled in daemon mode seems sufficient to me. |
@jonasschnelli in addition to a warning, we can even make For settings other than prune there might be similar workarounds on a case by case basis (other than warning). |
I like this approach. I think it'd be a simplification to stop using the windows registry and other config backends in One thing I don't understand about the implementation though is why the "Active command-line options that override above options" display is removed. Will command line settings not override config file settings anymore with this change? I think it would be bad if that were the case. |
@ryanofsky wrote:
They will. The phrase "active command-line options" actually referred to both Afaik QT can't tell the difference between settings that came from bitcoin.conf and those that came from a command line option, which is why I removed that text. It's also pretty difficult in practice to launch QT with command line options, involving editing desktop shortcuts etc. |
518f630
to
decad6a
Compare
Rebased and added pruning to the list of imported settings. I changed the meaning of disabling prune in the GUI to mean stop further pruning, instead undo previous pruning. It just sets |
@@ -243,6 +171,7 @@ static const QString GetDefaultProxyAddress() | |||
// read QSettings values and return them | |||
QVariant OptionsModel::data(const QModelIndex & index, int role) const | |||
{ | |||
int64_t prune = -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scope of prune
can be limited to the scope of case Prune
and case PruneSize
below :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That results in error: redefinition of 'prune'
.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
I'll rebase and fix code issues after the next upstream PR rebase. |
decad6a
to
09e150a
Compare
ec0d14e
to
4a72dcd
Compare
…is software itself
addOverriddenOption becomes an empty function to keep the diff simple, due to the many if statements without brackets. It will be removed in the next commit.
1c03dc1
to
3142a95
Compare
When QT launches, move the following QSettings to bitcoin_rw.conf: -lang (language) -dbcache (nDatabaseCache) -par (nThreadsScriptVerif) -prune (bPrune,nPruneSize) -spendzeroconfchange (bSpendZeroConfChange) -upnp (fUseUPnP) -listen (fListen) -proxy (fUseProxy) -onion (fUseSeparateProxyTor) Disabling pruning in the GUI now sets prune=1 if the chain is pruned, otherwise prune=0.
3142a95
to
b950472
Compare
Needs rebase |
Closing for now since this is dependant on a dormant PR #11082 |
I'll nag to reopen this once 11082 is rebased. |
@jonasschnelli 11082 is rebased, can you re-open this? |
I have to read up on the alternative approach that was merged. If I build on top of that, I'll make a new PR. For now, consider this up for grabs. |
When QT launches, move the following QSettings to
bitcoin_rw.conf
(added in #11082):-
lang
(language)-
dbcache
(nDatabaseCache)-
par
(nThreadsScriptVerif)-
prune
(bPrune,bPruneSize)-
spendzeroconfchange
(bSpendZeroConfChange)-
upnp
(fUseUPnP)-
listen
(fListen)-
proxy
(fUseProxy)-
onion
(fUseSeparateProxyTor)~This is a step towards being able to configure
prune
from the GUI (#6461). ~ (already done )There's potentially a safety benefit in storing
listen
,proxy
andonion
inbitcoin_rw.conf
in case the user ever decides to runbitcoind
.