Skip to content
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

[WIP] Display 'Connecting...' when connection to daemon is lost #829

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

j-berman
Copy link
Contributor

@j-berman j-berman commented Mar 25, 2022

The issue

When the client loses its connection to the daemon (phone loses service, or daemon doesn't respond, etc.), the UI displays the "synced" state with green check marks at whatever height the connection is lost:

When the client regains connection, the "synced" state remains in the UI, but the displayed height continues jumping forward (the client resumes scanning even though it says "synced"). Also note the "GIVE" button is clickable at this point, which could present other issues I didn't look into:

This PR's fix

If the client loses its connection to the daemon, after a bit of a delay, the client will re-enter the "Connecting..." state:

Upon re-connecting to the daemon, it re-enters the "Scanning" state:

Important note

This PR pairs with this change to wallet2 on the master branch. That change ensures refresh() does not mistakenly set the daemon's height to the scanned blockhain height when the daemon returns a failed a response.

I first noticed this general UI issue when observing behavior background scanning from 0 via 3rd party remote nodes. Turns out 3rd party remote node responses can be super flaky.

}

public void onStartRescan() {
unsync();
firstBlock = 0;
Copy link
Owner

Choose a reason for hiding this comment

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

i am not sure not unsetting firstBlock in unsync() has no adverse effects

Copy link
Contributor Author

@j-berman j-berman May 3, 2022

Choose a reason for hiding this comment

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

Is there another place unsync() is called I'm not seeing except in the place I added? Or do you mean that it should also unset the firstBlock even in that place I added the call to unsync()?

Copy link
Contributor Author

@j-berman j-berman May 3, 2022

Choose a reason for hiding this comment

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

Will dig into it/test it some more. The issue I was thinking with resetting it in that new call to unsync I added is if it might cause continual resets of the progress bar before it's synchronized IIRC

Copy link
Owner

Choose a reason for hiding this comment

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

i don*t see another place either. yes, i mean also unsetting firstBlock - maybe even scrapping this method as its only used once and has no obvious reuse scenario (or?).

connectionStatus = Wallet.ConnectionStatus.ConnectionStatus_Connected;
lastDaemonStatusUpdate = t;
} else {
if (t - lastDaemonStatusUpdate > STATUS_UPDATE_INTERVAL) {
long statusUpdateInterval = wallet.isSynchronized() ? STATUS_UPDATE_INTERVAL_SYNCED : STATUS_UPDATE_INTERVAL_SYNCING;
if (daemonHeight == 0 || t - lastDaemonStatusUpdate > statusUpdateInterval) {
Copy link
Contributor Author

@j-berman j-berman May 3, 2022

Choose a reason for hiding this comment

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

Also calling out this part. Notice how I added daemonHeight > 0 in the above if statement, and the first time updateDaemonState gets called, daemonHeight == 0, so it will fall into this if and make the request for the height. If the height is already cached, it won't be a problem.

The work over in monero-project/monero#8076 should minimize trips to the daemon and ideally get the height cached so the client shouldn't need to make a trip to the daemon here the first time this is called. Looking into this as well.

@m2049r
Copy link
Owner

m2049r commented May 15, 2022

do you know if the required core changes be in the upcoming fork?

@j-berman
Copy link
Contributor Author

Yep, required changes will be in

@m2049r m2049r changed the title Display 'Connecting...' when connection to daemon is lost [WIP] Display 'Connecting...' when connection to daemon is lost May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants