I’m opening this issue to get feedback and figure out how to resolve a disagreement that came up in https://github.com/bitcoin/bitcoin/pull/15936#discussion_r850568749.
Background
PR https://github.com/bitcoin/bitcoin/pull/15936 unifies Bitcoin-Qt and Bitcoind settings so they are stored in <datadir>/settings.json
instead of externally (in windows registry or external config directories via QSettings). It fixes current behavior where Bitcoind and Bitcoin-Qt can be started from the same datadir but may have inconsistent settings applied. It should make it easier to see what settings are in effect, because they will live in the datadir instead of being merged from outside sources. And it can enable new features like a bitcoin-cli config
command that can update the unified settings dynamically.
The problem is the <datadir>/settings.json
file does not currently store unused prune and proxy values when prune and proxy settings are disabled. So if you check the “Prune block storage” box and change the default “2GB” value to something else, then uncheck the box, then restart, then recheck the box, the previous value you typed will be lost, and the default “2GB” will be shown again. The same thing happens with the “Connect through SOCKS5 proxy” box. If you change the default tor proxy address “localhost:9050” to something else, and then disable the proxy, and restart, then recheck the box, the proxy address shown will be the default proxy address, not whatever proxy address you typed previously.
It is possible to change this behavior by storing unused proxy and prune settings somewhere. I don’t personally think storing unused proxy or pruning settings values is a good thing or that it justifies extra complexity. But it would be possible to implement as a followup to https://github.com/bitcoin/bitcoin/pull/15936. One approach I implemented in https://github.com/ryanofsky/bitcoin/commit/4e86ab5dfc9bf40502aca0f9e3a4690f6f5dfc19 does this by adding prune-prev
and proxy-prev
settings that hold unused values when corresponding prune
and proxy
settings are disabled. Other approaches like storing unused prune and proxy settings in QSettings, or completely changing the representation of prune and proxy settings so they have “enabled” fields separate from the value fields would also be possible.
Questions
-
What is ideal behavior when checking pruning/proxy boxes, typing pruning/proxy values, unchecking the boxes, restarting Bitcoin-Qt, checking the boxes again? Is it ideal to show default values (2GB and localhost:9050) when these boxes are checked? Or is ideal to show previous values? Or is some other behavior better?
-
Is this issue important and should it block #15936? Would it be ok for #15936 to implement simplest possible behavior of not saving unused prune and proxy values to disk, and displaying default pruning and proxy values when the boxes are checked after a restart?
Screenshots
These are the settings in question for reference