sparrow icon indicating copy to clipboard operation
sparrow copied to clipboard

make status bar red when can't connect to configured server (bitcoin core or electrum)

Open AndySchroder opened this issue 2 years ago • 12 comments

If the bitcoin core RPC or electrum server is not available, we have a grey status bar instead of a colored one (yellow, green, or blue on the lower right), but this is not a clear distinction from offline mode. If we expect the server to be connected, but it can't, it should be red in the lower right and not gray. Also, the "Connection failed" error goes away after a while. So, we can be left in a state where we are not sure if we are intentionally in offline mode, or if it is trying to connect, but it can't.

Also, I think under server preferences, we should have an option for no server connection ("Offline"), rather than just "Public Server", "Bitcoin Core", or "Private Electrum", that way one will not inadvertently go online to a public server if they didn't intend to by accidentally clicking the toggle button on the lower right of the status bar.

AndySchroder avatar Feb 08 '23 02:02 AndySchroder

So, we can be left in a state where we are not sure if we are intentionally in offline mode, or if it is trying to connect, but it can't.

There is merit to the "red toggle on failure" suggestion, but I wanted to note that the toggle pulses when it is trying to connect.

Also, I think under server preferences, we should have an option for no server connection

I understand the suggestion, but I think it adds too much UI heft and potential for user confusion fwiw. It's easy enough to select one of the non-public server options if this is a real concern.

craigraw avatar Feb 08 '23 07:02 craigraw

I don't see the toggle pulsing when it is trying to connect. What color is it supposed to pulse?

AndySchroder avatar Feb 08 '23 14:02 AndySchroder

If I try to unset a previously defined private electrum or bitcoin core server, it still gives some error message saying "Connection failed ...." that comes and goes. That's another reason why I think it would be better to have an explicit "Offline" mode. If I delete the ~/.sparrow/config file, then I don't have this issue. It seems as though "coreServer": "http://" and "electrumServer": "tcp://" remain in the config file after previously defining them.

AndySchroder avatar Feb 08 '23 15:02 AndySchroder

It's easy enough to select one of the non-public server options if this is a real concern.

Would prefer this to be the default then if you select "Later or Offline Mode" during initial startup. Currently if I select that "Later or Offline Mode" button, the "Public Server" tab is selected under server preferences and I can accidentally go online to a public server by clicking the toggle button in the lower right status bar.

AndySchroder avatar Feb 08 '23 15:02 AndySchroder

Also, if I:

  1. Start Sparrow fresh
  2. Choose "Configure Server"
  3. Choose Private Electrum
  4. Leave the server URL blank
  5. Click Close
  6. Click the toggle in the lower right of the status bar

Then it makes the toggle in the lower right stay blue and gives no error messages. What is it doing in this scenario?

If I then: 7. File->Preferences->Server->Bitcoin Core 8. Click Close

Then the toggle in the bottom right turns green. It doesn't give any error messages, and it stays that way.

If I then: 9. Help->Show Introduction->Next->Next->Next->Later or Offline mode

It still stays green. Would prefer this to send you back to offline mode, or change the button to say "Keep Current Settings"

AndySchroder avatar Feb 08 '23 15:02 AndySchroder

I don't see the toggle pulsing when it is trying to connect. What color is it supposed to pulse?

pulsing

Then it makes the toggle in the lower right stay blue and gives no error messages. What is it doing in this scenario?

Nothing. I agree this appeared confusing though, so the toggle button is now disabled when no server is configured. This eliminates the Introduction dialog issue as well.

If I try to unset a previously defined private electrum or bitcoin core server, it still gives some error message saying "Connection failed ...." that comes and goes.

Clearing the the URL host field for either of these two server types will now disable the server toggle as well.

Changes in 545342df.

craigraw avatar Feb 09 '23 08:02 craigraw

The pulsing shown in your GIF only happens when actually connecting to a server. If you have a bad URL and it is not actually connecting, it won't pulse.

AndySchroder avatar Feb 09 '23 08:02 AndySchroder

The pulsing shown in your GIF only happens when actually connecting to a server. If you have a bad URL and it is not actually connecting, it won't pulse.

That should no longer be a possible state.

craigraw avatar Feb 09 '23 08:02 craigraw

Seems like it should pulse red in this state, per your original comment agreeing with my first request? The state that is no longer possible is a URL which is empty, right?

AndySchroder avatar Feb 09 '23 08:02 AndySchroder

The toggle will simply be disabled if the URL host is empty, so it is impossible to trigger it.

craigraw avatar Feb 09 '23 09:02 craigraw

Right, but there can still be a non emtpy URL that is bad. In that case, what happens?

AndySchroder avatar Feb 09 '23 09:02 AndySchroder

The connection will fail, either immediately or after trying for a little while depending on the error. The toggle will return to an offline state, and the status bar will display the reason for the failure.

craigraw avatar Feb 09 '23 09:02 craigraw