Skip to content

Conversation

ryanofsky
Copy link
Contributor

@ryanofsky ryanofsky commented May 1, 2019

Add interfaces::Node updateSetting, forceSetting, resetSettings, isSettingIgnored, and getPersistentSetting methods so GUI is able to manipulate settings.json file and use and modify node settings.

(Originally this PR also contained GUI changes to unify bitcoin-qt and bitcoind persistent settings and call these methods, but the GUI commits have been dropped from this PR and moved to bitcoin-core/gui/pull/602)

@DrahtBot
Copy link
Contributor

DrahtBot commented May 2, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #24479 (Bugfix: util: Correctly handle Number value types in GetArg/GetBoolArg by luke-jr)

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.

ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request May 3, 2019
Persistent settings are used in followup PRs bitcoin#15936 to unify gui settings
between bitcoin-qt and bitcoind, and bitcoin#15937 to add a load_on_startup flag to
the loadwallet RPC and maintain a dynamic list of wallets that should be loaded
on startup that also can be shared between bitcoind and bitcoin-qt.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request May 7, 2019
Persistent settings are used in followup PRs bitcoin#15936 to unify gui settings
between bitcoin-qt and bitcoind, and bitcoin#15937 to add a load_on_startup flag to
the loadwallet RPC and maintain a dynamic list of wallets that should be loaded
on startup that also can be shared between bitcoind and bitcoin-qt.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request May 8, 2019
Persistent settings are used in followup PRs bitcoin#15936 to unify gui settings
between bitcoin-qt and bitcoind, and bitcoin#15937 to add a load_on_startup flag to
the loadwallet RPC and maintain a dynamic list of wallets that should be loaded
on startup that also can be shared between bitcoind and bitcoin-qt.
@jonasschnelli
Copy link
Contributor

Concept ACK

@laanwj laanwj added the Feature label Sep 30, 2019
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Dec 3, 2019
Persistent settings are used in followup PRs bitcoin#15936 to unify gui settings
between bitcoin-qt and bitcoind, and bitcoin#15937 to add a load_on_startup flag to
the loadwallet RPC and maintain a dynamic list of wallets that should be loaded
on startup that also can be shared between bitcoind and bitcoin-qt.
@ryanofsky
Copy link
Contributor Author

ryanofsky commented Dec 4, 2019

Travis compile error in https://travis-ci.org/bitcoin/bitcoin/jobs/620388014#L3988 seems to be due to a clang bug with macros and raw strings: https://reviews.llvm.org/D39279

qt/test/optiontests.cpp:56:100: warning: missing terminating '"' character [-Winvalid-pp-token]
)", "std::string(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()).c_str()", "R\"({
                                                                                                   ^
qt/test/optiontests.cpp:56:100: error: expected expression

Maybe can work around by adding parentheses, otherwise could declare temp variable.


Other travis error https://travis-ci.org/bitcoin/bitcoin/jobs/620388019#L2929 seems like a qsettings int value gets stringified on mac (doesn't happen on linux):

Actual: "dbcache": "600",
Expected: "dbcache": 600,

It would probably be good to fix this by adding an explicit type argument to ToSetting instead of trying to guess the setting type from the variant type


Rebased 0ab41dd -> 955f7c0 (pr/qtset.4 -> pr/qtset.5) after #15934 merge
Rebased 955f7c0 -> 821268f (pr/qtset.5 -> pr/qtset.6, compare) due to conflicts with #17473, #17696, #17453, and #18914 and with attempted fixes for travis errors above
Updated 821268f -> dc4da09 (pr/qtset.6 -> pr/qtset.7, compare) with travis and appveyor fixes for https://travis-ci.org/github/bitcoin/bitcoin/jobs/694791815#L2411 and https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/33325125#L55
Rebased dc4da09 -> ccd6331 (pr/qtset.7 -> pr/qtset.8, compare) due to conflict with #19233, on updated base pr #15935 pr/rwset.11
Rebased ccd6331 -> 196f666 (pr/qtset.8 -> pr/qtset.9, compare) on top of #15934 pr/rwset.13
Rebased 196f666 -> 1b216f0 (pr/qtset.9 -> pr/qtset.10, compare) after #19412 to fix TSAN feature_block timeout https://travis-ci.org/github/bitcoin/bitcoin/jobs/703174898
Rebased 1b216f0 -> 9ad8ee9 (pr/qtset.10 -> pr/qtset.11, compare) on top of #15935 pr/rwset.14
Rebased 9ad8ee9 -> 8aa59db (pr/qtset.11 -> pr/qtset.12, compare) after #15935 merge
Rebased 8aa59db -> 6634f86 (pr/qtset.12 -> pr/qtset.13, compare) due to conflict with bitcoin-core/gui#35
Updated 6634f86 -> 1dd17b4 (pr/qtset.13 -> pr/qtset.14, compare) fixing missing #include and silent conflict with #15937
Updated 1dd17b4 -> 15f3416 (pr/qtset.14 -> pr/qtset.15, compare) fixing unit test error
Rebased 15f3416 -> 66ab29d (pr/qtset.15 -> pr/qtset.16, compare) due to conflicts with #18077, #20494, and #21531
Rebased 66ab29d -> 9d4ff45 (pr/qtset.16 -> pr/qtset.17, compare) due to conflicts with #21727 and #21850 (silent)
Rebased 9d4ff45 -> 46cef15 (pr/qtset.17 -> pr/qtset.18, compare) due to conflict with bitcoin-core/gui#313
Updated 46cef15 -> ca1c704 (pr/qtset.18 -> pr/qtset.19, compare) with a compile fix to fix the same conflict
Rebased ca1c704 -> c026213 (pr/qtset.19 -> pr/qtset.20, compare) due to conflict with bitcoin-core/gui#4
Rebased c026213 -> 73b31c1 (pr/qtset.20 -> pr/qtset.21, compare) due to conflict with bitcoin-core/gui#390
Rebased 73b31c1 -> 17fcdf5 (pr/qtset.21 -> pr/qtset.22, compare) due to conflict with #22219

ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jun 4, 2020
Persistent settings are used in followup PRs bitcoin#15936 to unify gui settings
between bitcoin-qt and bitcoind, and bitcoin#15937 to add a load_on_startup flag to
the loadwallet RPC and maintain a dynamic list of wallets that should be loaded
on startup that also can be shared between bitcoind and bitcoin-qt.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jun 4, 2020
Persistent settings are used in followup PRs bitcoin#15936 to unify gui settings
between bitcoin-qt and bitcoind, and bitcoin#15937 to add a load_on_startup flag to
the loadwallet RPC and maintain a dynamic list of wallets that should be loaded
on startup that also can be shared between bitcoind and bitcoin-qt.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jun 4, 2020
Persistent settings are used in followup PRs bitcoin#15936 to unify gui settings
between bitcoin-qt and bitcoind, and bitcoin#15937 to add a load_on_startup flag to
the loadwallet RPC and maintain a dynamic list of wallets that should be loaded
on startup that also can be shared between bitcoind and bitcoin-qt.
@ryanofsky ryanofsky changed the title WIP: Unify bitcoin-qt and bitcoind persistent settings Unify bitcoin-qt and bitcoind persistent settings Jun 4, 2020
@ryanofsky ryanofsky marked this pull request as ready for review June 4, 2020 20:12
Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

re-ACK 3340286

@Rspigler
Copy link
Contributor

I will re-test tomorrow. Thanks for keeping this up!

maflcko pushed a commit to bitcoin-core/gui that referenced this pull request May 20, 2022
1d4122d init: Allow -proxy="" setting values (Ryan Ofsky)

Pull request description:

  This drops the `No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>` error when a empty `-proxy=` command line argument, `bitcoin.conf` value, or `settings.json` value is specified, and just makes bitcoin connect and listen normally in these cases.

  The error was originally added in bitcoin/bitcoin#20003 to prevent a bare `-proxy` command line argument with no assignment from clearing proxy settings. But it was implemented in an overbroad way breaking empty `-proxy=` assignments as well.

  The motivation for this change is to prevent a GUI bug that happens with bitcoin/bitcoin#15936, reported in bitcoin/bitcoin#15936 (review) by vasild, that happens after a proxy setting is enabled and disabled in the GUI. But this change also makes sense on its own to remove a potentially confusing error message.

ACKs for top commit:
  hebasto:
    re-ACK 1d4122d, only rebased since my recent [review](bitcoin/bitcoin#24830 (review)).

Tree-SHA512: 753adfce199ed078a6cd9e0ea78e76c0b14070f8fcfe2a4632cd0c6dfe6b4e135ddffbe11a97e5e30520ea9e5bda00bad1493cbaef74cf425aa8613249167f53
Copy link
Contributor

@vasild vasild left a comment

Choose a reason for hiding this comment

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

ACK 3340286

ryanofsky added a commit to ryanofsky/gui that referenced this pull request May 20, 2022
This provides a way for the GUI settings dialog box to retain previous pruning
and proxy settings when they are disabled, as requested by vasild:

bitcoin/bitcoin#15936 (review)
bitcoin/bitcoin#15936 (comment)
bitcoin/bitcoin#15936 (comment)

Importantly, while this PR changes the settings.json format, it changes it in a
fully backwards compatible way, so previous versious of bitcoind and bitcoin-qt
will correctly interpret prune, proxy, and onion settins written by new
versions of bitcoin-qt.
@Rspigler
Copy link
Contributor

tACK 3340286

Tested with various changes to settings.json, bitcoin.conf, and the GUI. Everything behaved as it should.

Previous issues people reported are resolved (including #24457).

Only other issue is solved by bitcoin-core/gui#603

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

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

Concept ACK, unifying persistent node settings across apps makes sense to me.

@Rspigler
Copy link
Contributor

tACK 3340286 all tests pass

naumenkogs pushed a commit to naumenkogs/bitcoin that referenced this pull request May 23, 2022
This drops the `No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>`
error when a empty `-proxy=` command line argument, `bitcoin.conf` value, or
`settings.json` value is specified, and just makes bitcoin connect and listen
normally in these cases.

The error was originally added in bitcoin#20003
to prevent a bare `-proxy` command line argument with no assignment from
clearing proxy settings. But it was implemented in an overbroad way breaking
empty `-proxy=` assignments as well.

The motivation for this change is to prevent a GUI bug that happens with
bitcoin#15936, reported in
bitcoin#15936 (review) by
vasild, that happens after a proxy setting is enabled and disabled in the GUI.
But this change also makes sense on its own to remove a potentially confusing
error message.
Copy link
Contributor Author

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Updated 3340286 -> f9fdcec (pr/qtset.46 -> pr/qtset.47, compare) just renaming updateSetting to updateRwSetting;

hebasto added a commit to bitcoin-core/gui that referenced this pull request May 24, 2022
…l constructor

31122aa refactor: Pass interfaces::Node references to OptionsModel constructor (Ryan Ofsky)

Pull request description:

  Giving OptionsModel access to the node interface is needed as part of #602 to get bitcoind and bitcoin-qt to use the same settings instead of different settings.

  It has been split off from #602 to simplify that PR. Previously these commits were part of bitcoin/bitcoin#15936 and also had some review discussion there.

ACKs for top commit:
  promag:
    Code review ACK 31122aa.
  furszy:
    Code ACK 31122aa
  jarolrod:
    ACK 31122aa

Tree-SHA512: b8529322fd7ba97e19864129e6cf5f9acc58c124f2e5a7c50aca15772c8549de3c24e8b0c27e8cf2c06fd26529e9cdb898b0788a1de3cbfdfbdd3f85c9f0fe69
Copy link
Contributor

@vasild vasild left a comment

Choose a reason for hiding this comment

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

ACK f9fdcec

laanwj added a commit that referenced this pull request May 25, 2022
…ettings.json

344537c qt: Avoid crash on startup if int specified in settings.json (Ryan Ofsky)

Pull request description:

  Backport of #24498 to 22.x branch

  This was already backported to the 23.x branch in #24511, but vasild discovered the issue can affect 22.x as well #15936 (comment):

  > While testing this, 22.x crashes if `settings.json` contains `"prune": 1234` due to #24498 which was fixed in 23.0. So, if this PR is included in 24.x and a user upgrades to 24.x and then downgrades to 22.x his 22.x would crash at startup.

  It's not very important to backport this to 22.x because I can work around the issue other ways, but I do see 22.x is listed as an active branch https://github.com/bitcoin/bitcoin/branches, so if there is another 22.x release, it would be nice to have this fix and not have a wonky uncaught univalue exception waiting to be hit

ACKs for top commit:
  laanwj:
    ACK 344537c

Tree-SHA512: 479f7fb4b4b73ec85f28e97af9b21d54245b8ab4d246e50134b37f1726fe3c57cf388fe4973f8ccf1b9efa7663166d1fbeb631758b39d4490b5eab82d0c83d77
Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

re-ACK f9fdcec, only a function renamed since my recent review.

Copy link
Contributor Author

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

This is probably ready for merge (sorry for the confusing history, it was originally a lot bigger PR before I removed the GUI parts)

@maflcko maflcko merged commit 2642dee into bitcoin:master May 26, 2022
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 28, 2022
…s to OptionsModel constructor

31122aa refactor: Pass interfaces::Node references to OptionsModel constructor (Ryan Ofsky)

Pull request description:

  Giving OptionsModel access to the node interface is needed as part of bitcoin#602 to get bitcoind and bitcoin-qt to use the same settings instead of different settings.

  It has been split off from bitcoin#602 to simplify that PR. Previously these commits were part of bitcoin#15936 and also had some review discussion there.

ACKs for top commit:
  promag:
    Code review ACK 31122aa.
  furszy:
    Code ACK 31122aa
  jarolrod:
    ACK 31122aa

Tree-SHA512: b8529322fd7ba97e19864129e6cf5f9acc58c124f2e5a7c50aca15772c8549de3c24e8b0c27e8cf2c06fd26529e9cdb898b0788a1de3cbfdfbdd3f85c9f0fe69
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 28, 2022
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 7, 2022
…storage

9c69cfe Add <datadir>/settings.json persistent settings storage. (Russell Yanofsky)
eb682c5 util: Add ReadSettings and WriteSettings functions (Russell Yanofsky)

Pull request description:

  Persistent settings are used in followup PRs bitcoin#15936 to unify gui settings between bitcoin-qt and bitcoind, and bitcoin#15937 to add a load_on_startup flag to the loadwallet RPC and maintain a dynamic list of wallets that should be loaded on startup that also can be shared between bitcoind and bitcoin-qt.

ACKs for top commit:
  MarcoFalke:
    Approach re-ACK 9c69cfe 🌾
  jnewbery:
    utACK 9c69cfe

Tree-SHA512: 39fcc6051717117c9141e934de1d0d3f739484be4685cdf97d54de967c8c816502b4fd0de12114433beaa5c5b7060c810fd8ae4e2b3ce7c371eb729ac01ba2e1
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 7, 2022
…storage

9c69cfe Add <datadir>/settings.json persistent settings storage. (Russell Yanofsky)
eb682c5 util: Add ReadSettings and WriteSettings functions (Russell Yanofsky)

Pull request description:

  Persistent settings are used in followup PRs bitcoin#15936 to unify gui settings between bitcoin-qt and bitcoind, and bitcoin#15937 to add a load_on_startup flag to the loadwallet RPC and maintain a dynamic list of wallets that should be loaded on startup that also can be shared between bitcoind and bitcoin-qt.

ACKs for top commit:
  MarcoFalke:
    Approach re-ACK 9c69cfe 🌾
  jnewbery:
    utACK 9c69cfe

Tree-SHA512: 39fcc6051717117c9141e934de1d0d3f739484be4685cdf97d54de967c8c816502b4fd0de12114433beaa5c5b7060c810fd8ae4e2b3ce7c371eb729ac01ba2e1
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 10, 2022
…storage

9c69cfe Add <datadir>/settings.json persistent settings storage. (Russell Yanofsky)
eb682c5 util: Add ReadSettings and WriteSettings functions (Russell Yanofsky)

Pull request description:

  Persistent settings are used in followup PRs bitcoin#15936 to unify gui settings between bitcoin-qt and bitcoind, and bitcoin#15937 to add a load_on_startup flag to the loadwallet RPC and maintain a dynamic list of wallets that should be loaded on startup that also can be shared between bitcoind and bitcoin-qt.

ACKs for top commit:
  MarcoFalke:
    Approach re-ACK 9c69cfe 🌾
  jnewbery:
    utACK 9c69cfe

Tree-SHA512: 39fcc6051717117c9141e934de1d0d3f739484be4685cdf97d54de967c8c816502b4fd0de12114433beaa5c5b7060c810fd8ae4e2b3ce7c371eb729ac01ba2e1
hebasto added a commit that referenced this pull request Jun 12, 2022
…settings

e47c6c7 Reset settings.json when GUI options are reset (Ryan Ofsky)
99ccc02 Add release notes about unified bitcoin-qt and bitcoind persistent settings (Ryan Ofsky)
504b06b Migrate -lang setting from QSettings to settings.json (Ryan Ofsky)
9a016a3 Migrate -prune setting from QSettings to settings.json (Ryan Ofsky)
f067e19 Migrate -proxy and -onion settings from QSettings to settings.json (Ryan Ofsky)
a09e3b7 Migrate -listen and -server settings from QSettings to settings.json (Ryan Ofsky)
d2ada6e Migrate -upnp and -natpmp settings from QSettings to settings.json (Ryan Ofsky)
1dc4fc2 Migrate -spendzeroconfchange and -signer settings from QSettings to settings.json (Ryan Ofsky)
a7ef6d5 Migrate -par setting from QSettings to settings.json (Ryan Ofsky)
284f339 Migrate -dbcache setting from QSettings to settings.json (Ryan Ofsky)

Pull request description:

  If a setting like pruning, port mapping, or a network proxy is enabled in the GUI, it will now be stored in the bitcoin persistent setting file in the datadir and shared with bitcoind, instead of being stored as Qt settings which end up in the the windows registry or platform specific config files and are ignored by bitcoind.

  This PR has been split off from #15936 so some review of these commits previously took place in that PR.

ACKs for top commit:
  furszy:
    Code review ACK e47c6c76
  hebasto:
    ACK e47c6c7

Tree-SHA512: 076ea7c7efe67805b4a357113bfe1643dce364d0032774106de59566a0ed5771d57a5923920085e03d686beb34b98114bd278555dfdf8bb7af0b778b0f35b7d2
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 14, 2022
…storage

9c69cfe Add <datadir>/settings.json persistent settings storage. (Russell Yanofsky)
eb682c5 util: Add ReadSettings and WriteSettings functions (Russell Yanofsky)

Pull request description:

  Persistent settings are used in followup PRs bitcoin#15936 to unify gui settings between bitcoin-qt and bitcoind, and bitcoin#15937 to add a load_on_startup flag to the loadwallet RPC and maintain a dynamic list of wallets that should be loaded on startup that also can be shared between bitcoind and bitcoin-qt.

ACKs for top commit:
  MarcoFalke:
    Approach re-ACK 9c69cfe 🌾
  jnewbery:
    utACK 9c69cfe

Tree-SHA512: 39fcc6051717117c9141e934de1d0d3f739484be4685cdf97d54de967c8c816502b4fd0de12114433beaa5c5b7060c810fd8ae4e2b3ce7c371eb729ac01ba2e1
janus pushed a commit to BitgesellOfficial/bitgesell that referenced this pull request Aug 4, 2022
This drops the `No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>`
error when a empty `-proxy=` command line argument, `bitcoin.conf` value, or
`settings.json` value is specified, and just makes bitcoin connect and listen
normally in these cases.

The error was originally added in bitcoin/bitcoin#20003
to prevent a bare `-proxy` command line argument with no assignment from
clearing proxy settings. But it was implemented in an overbroad way breaking
empty `-proxy=` assignments as well.

The motivation for this change is to prevent a GUI bug that happens with
bitcoin/bitcoin#15936, reported in
bitcoin/bitcoin#15936 (review) by
vasild, that happens after a proxy setting is enabled and disabled in the GUI.
But this change also makes sense on its own to remove a potentially confusing
error message.
ryanofsky added a commit to ryanofsky/gui that referenced this pull request Sep 21, 2022
This provides a way for the GUI settings dialog box to retain previous pruning
and proxy settings when they are disabled, as requested by vasild:

bitcoin/bitcoin#15936 (review)
bitcoin/bitcoin#15936 (comment)
bitcoin/bitcoin#15936 (comment)

Importantly, while this PR changes the settings.json format, it changes it in a
fully backwards compatible way, so previous versious of bitcoind and bitcoin-qt
will correctly interpret prune, proxy, and onion settins written by new
versions of bitcoin-qt.
ryanofsky added a commit to ryanofsky/gui that referenced this pull request Sep 21, 2022
This provides a way for the GUI settings dialog box to retain previous pruning
and proxy settings when they are disabled, as requested by vasild:

bitcoin/bitcoin#15936 (review)
bitcoin/bitcoin#15936 (comment)
bitcoin/bitcoin#15936 (comment)

Importantly, while this PR changes the settings.json format, it changes it in a
fully backwards compatible way, so previous versious of bitcoind and bitcoin-qt
will correctly interpret prune, proxy, and onion settins written by new
versions of bitcoin-qt.
josibake pushed a commit to josibake/bitcoin that referenced this pull request Apr 5, 2023
This provides a way for the GUI settings dialog box to retain previous pruning
and proxy settings when they are disabled, as requested by vasild:

bitcoin#15936 (review)
bitcoin#15936 (comment)
bitcoin#15936 (comment)

Importantly, while this PR changes the settings.json format, it changes it in a
fully backwards compatible way, so previous versious of bitcoind and bitcoin-qt
will correctly interpret prune, proxy, and onion settins written by new
versions of bitcoin-qt.
@bitcoin bitcoin locked and limited conversation to collaborators May 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.