Persist Proxy settings #433

Closed
pablomartin4btc wants to merge 1 commit from qml-proxy-settings-persistence into main AGit
pablomartin4btc commented 2024-11-14 20:00:39 +00:00 (Migrated from github.com)

(This is based on top of #430).

Adding the required logic to persist the configuration of both default Proxy and Tor proxy values to settings.json(location).

Disabling a proxy thru its switch will remove the setting from the config file.


What to test on this PR:

Simply verify that the proxy value entered in the UI gets persisted into the file mentioned above, and if you manually touch the file or restart the application, the UI reflects the values read from the file.

How to test that the Proxy feature it's actually working:

1. Start bitcoin-qt with rpc enabled (with `-proxy` option OR leave it without it to verify that the value is getting read from the `settings.json` file).

./src/qt/bitcoin-qt -regtest -proxy=127.0.0.1 -server=1

2. Run rpc getnetworkinfo from bitcoin-cli to verify the proxy has been set (you might need to update the -rpcport according to the chainnet selected option).
./src/bitcoin-cli -regtest -rpcport=18443 getnetworkinfo
{
  "version": 259900,
  "subversion": "/Satoshi:25.99.0/",
  "protocolversion": 70016,
  "localservices": "0000000000000409",
  "localservicesnames": [
    "NETWORK",
    "WITNESS",
    "NETWORK_LIMITED"
  ],
  "localrelay": true,
  "timeoffset": 0,
  "networkactive": true,
  "connections": 0,
  "connections_in": 0,
  "connections_out": 0,
  "networks": [
    {
      "name": "ipv4",
      "limited": false,
      "reachable": true,
      "proxy": "127.0.0.1:9050",
...

  1. If you wish to check also the proper proxy traffic you can setup up a local proxy following the "Test instructions" section at the top description of the gui PR #836.
_(This is based on top of #430)._ Adding the required logic to persist the configuration of both default Proxy and Tor proxy values to `settings.json`([location](https://github.com/bitcoin-core/gui-qml/blob/main/doc/files.md)). Disabling a proxy thru its switch will remove the setting from the config file. --- <ins>_What to test on this PR_</ins>: Simply verify that the proxy value entered in the UI gets persisted into the file mentioned above, and if you manually touch the file or restart the application, the UI reflects the values read from the file. <ins>_How to test that the Proxy feature it's actually working_</ins>: <details> <summary>1. Start <code>bitcoin-qt</code> with rpc enabled (with `-proxy` option OR leave it without it to verify that the value is getting read from the `settings.json` file).</summary> `./src/qt/bitcoin-qt -regtest -proxy=127.0.0.1 -server=1` </details> <details> <summary>2. Run rpc <code>getnetworkinfo</code> from <code>bitcoin-cli</code> to verify the proxy has been set (you might need to update the <code>-rpcport</code> according to the chainnet selected option).</summary> ``` ./src/bitcoin-cli -regtest -rpcport=18443 getnetworkinfo { "version": 259900, "subversion": "/Satoshi:25.99.0/", "protocolversion": 70016, "localservices": "0000000000000409", "localservicesnames": [ "NETWORK", "WITNESS", "NETWORK_LIMITED" ], "localrelay": true, "timeoffset": 0, "networkactive": true, "connections": 0, "connections_in": 0, "connections_out": 0, "networks": [ { "name": "ipv4", "limited": false, "reachable": true, "proxy": "127.0.0.1:9050", ... ``` </details> 3. If you wish to check also the proper proxy traffic you can setup up a local proxy following the "_Test instructions_" section at the top description of the `gui` PR [#836](https://github.com/bitcoin-core/gui/pull/836#issue-2527108426).
D33r-Gee commented 2024-12-04 17:32:18 +00:00 (Migrated from github.com)

does it need rebase?

does it need rebase?
D33r-Gee (Migrated from github.com) reviewed 2024-12-05 18:10:06 +00:00
D33r-Gee (Migrated from github.com) left a comment

tACK 8ef413b works as expected on Ubuntu 20.04

Ubuntu 20.04 screenshots

Screenshot 2024-12-05 100228
settings.json:
Screenshot 2024-12-05 100245

tACK [8ef413b](https://github.com/bitcoin-core/gui-qml/commit/8ef413bee3bcbd797c83adac46a455b80a3b6049) works as expected on Ubuntu 20.04 <details> <summary>Ubuntu 20.04 screenshots</summary> ![Screenshot 2024-12-05 100228](https://git.fish.foo/attachments/5e9a6845-486e-4688-a511-aef23bcae73d) settings.json: ![Screenshot 2024-12-05 100245](https://git.fish.foo/attachments/1a9dd331-908a-431c-a7b2-f639aecdadba) </details>
hebasto commented 2025-05-12 08:34:58 +00:00 (Migrated from github.com)

Is this specific to the QML GUI, or is it related to the Qt Widget-based GUI as well?

Is this specific to the QML GUI, or is it related to the Qt Widget-based GUI as well?
pablomartin4btc commented 2025-05-12 18:09:02 +00:00 (Migrated from github.com)

Is this specific to the QML GUI, or is it related to the Qt Widget-based GUI as well?

This is purely QML GUI, Qt could benefit from it by reusing the proxy validation from the node interface instead of having it currently within the widget (optionsdialog.cpp -> ProxyAddressValidator::validate()).

> Is this specific to the QML GUI, or is it related to the Qt Widget-based GUI as well? This is purely QML GUI, Qt could benefit from it by reusing the proxy validation from the node interface instead of having it currently within the widget (`optionsdialog.cpp` -> `ProxyAddressValidator::validate()`).
hebasto commented 2025-07-25 20:19:27 +00:00 (Migrated from github.com)

Closing for now.

Feel free to reopen this based on the new default branch.

Closing for now. Feel free to reopen this based on the new [default](https://github.com/bitcoin-core/gui-qml/tree/qt6) branch.
Sign in to join this conversation.
No description provided.