No indication that wallet is rescanning after importing private key and restarting SilentDragon #87

Open
opened 2 years ago by fekt · 11 comments
fekt commented 2 years ago
Collaborator

Users should be able to see rescan status when restarting SilentDragon after importing a private key. Currently, the splash screen only displays "The Dragon Awakens." Users must check debug.log to see rescan progress and status.

Users should be able to see rescan status when restarting SilentDragon after importing a private key. Currently, the splash screen only displays "The Dragon Awakens." Users must check `debug.log` to see rescan progress and status.
Owner

@fekt I agree this sucks and we should show users the current status of a rescan in the GUI

@fekt I agree this sucks and we should show users the current status of a rescan in the GUI
Poster
Collaborator

@duke It may have started rescanning after importing key, but not sure because I got impatient and restarted wallet. It at least gave some alert that rescan could take awhile after importing key. Just no indication after restarting wallet that rescan was being performed. I can try to look at it at some point if nobody else does. If it's logging progress it can't be too hard to display it.

@duke It may have started rescanning after importing key, but not sure because I got impatient and restarted wallet. It at least gave some alert that rescan could take awhile after importing key. Just no indication after restarting wallet that rescan was being performed. I can try to look at it at some point if nobody else does. If it's logging progress it can't be too hard to display it.
Owner

@fekt yeah, we do have a single popup that says "rescan could take a long time" but other than that, the GUI has no idea if a rescan is happening or what % complete it is. We definitely need this feature.

To implement this feature, the GUI should be looking at debug.log to see if it sees rescan log lines.

The best thing to look for is likely this log print:

LogPrintf("Still rescanning. At block %d. Progress=%f\n", pindex->GetHeight(), Checkpoints::GuessVerificationProgress(chainParams.Checkpoints(), pindex));

so we can use a regex to grab the progress % and render it somewhere in the GUI, probably the status bar. I can help with this task, it's not too complex and a good way to learn about SD.

@fekt yeah, we do have a single popup that says "rescan could take a long time" but other than that, the GUI has no idea if a rescan is happening or what % complete it is. We definitely need this feature. To implement this feature, the GUI should be looking at debug.log to see if it sees rescan log lines. The best thing to look for is likely this log print: ``` LogPrintf("Still rescanning. At block %d. Progress=%f\n", pindex->GetHeight(), Checkpoints::GuessVerificationProgress(chainParams.Checkpoints(), pindex)); ``` so we can use a regex to grab the progress % and render it somewhere in the GUI, probably the status bar. I can help with this task, it's not too complex and a good way to learn about SD.
Owner

We can now use the getrescaninfo RPC, if the hushd SD is talking to has it.

We can now use the `getrescaninfo` RPC, if the hushd SD is talking to has it.
Poster
Collaborator

I noticed this code in hushd when reviewing how other wallets may handle rescanning on restart and without restarting. ShowProgress seems capable of pushing messages/data to the UI using a boost signal.
https://git.hush.is/hush/hush3/src/branch/master/src/wallet/wallet.cpp#L2772

Ocassionally I'll see "Rescanning...", but I've never seen the progress. May not even need to call RPC from GUI.

I noticed this code in hushd when reviewing how other wallets may handle rescanning on restart and without restarting. `ShowProgress` seems capable of pushing messages/data to the UI using a boost signal. https://git.hush.is/hush/hush3/src/branch/master/src/wallet/wallet.cpp#L2772 Ocassionally I'll see "Rescanning...", but I've never seen the progress. May not even need to call RPC from GUI.
Owner

@fekt when I tested the latest dev branch code, started a rescan, stopped SD and restarted it while it was rescanning, I get similar behavior as you describe. For this testing, I have "watch ./src/hush-cli getrescaninfo" running in a terminal to see what the RPC data looks like and it seems that even at the RPC layer, getrescaninfo returns rescanning=false for maybe a minute or two during startup, then starts to return the real data, but the GUI doesn't realize it.

So it seems part of the problem is at the RPC level but also the GUI doesn't seem to update when getrescaninfo starts to return rescan data.

I am testing some code changes to see what I can do.

@fekt when I tested the latest dev branch code, started a rescan, stopped SD and restarted it while it was rescanning, I get similar behavior as you describe. For this testing, I have "watch ./src/hush-cli getrescaninfo" running in a terminal to see what the RPC data looks like and it seems that even at the RPC layer, getrescaninfo returns rescanning=false for maybe a minute or two during startup, then starts to return the real data, but the GUI doesn't realize it. So it seems part of the problem is at the RPC level but also the GUI doesn't seem to update when getrescaninfo starts to return rescan data. I am testing some code changes to see what I can do.
Owner

@fekt when I tested the latest dev branch code, started a rescan, stopped SD and restarted it while it was rescanning, I get similar behavior as you describe. For this testing, I have "watch ./src/hush-cli getrescaninfo" running in a terminal to see what the RPC data looks like and it seems that even at the RPC layer, getrescaninfo returns rescanning=false for maybe a minute or two during startup, then starts to return the real data, but the GUI doesn't realize it.

So it seems part of the problem is at the RPC level but also the GUI doesn't seem to update when getrescaninfo starts to return rescan data.

I am testing some code changes to see what I can do.

@fekt when I tested the latest dev branch code, started a rescan, stopped SD and restarted it while it was rescanning, I get similar behavior as you describe. For this testing, I have "watch ./src/hush-cli getrescaninfo" running in a terminal to see what the RPC data looks like and it seems that even at the RPC layer, getrescaninfo returns rescanning=false for maybe a minute or two during startup, then starts to return the real data, but the GUI doesn't realize it. So it seems part of the problem is at the RPC level but also the GUI doesn't seem to update when getrescaninfo starts to return rescan data. I am testing some code changes to see what I can do.
Poster
Collaborator

@duke To clarify, the latest SD code in dev branch won't show progress or call RPC on a restart. Previously I was doing that with reading debug.log and it only updated status on a restart and displayed in animated splash screen.

The current code will only call the RPC and update status in bottom left status bar when rescanning from "Settings" while SD is open.

This is some other relevant code in SD, which I think is what might be using a boost signal from hushd to display on startup: https://git.hush.is/hush/SilentDragon/src/branch/dev/src/connection.cpp#L527

It's possible the "popcorn" message is just overriding details that would show progress, but removing it would need to be tested.

@duke To clarify, the latest SD code in dev branch won't show progress or call RPC on a restart. Previously I was doing that with reading debug.log and it only updated status on a restart and displayed in animated splash screen. The current code will only call the RPC and update status in bottom left status bar when rescanning from "Settings" while SD is open. This is some other relevant code in SD, which I think is what might be using a boost signal from hushd to display on startup: https://git.hush.is/hush/SilentDragon/src/branch/dev/src/connection.cpp#L527 It's possible the "popcorn" message is just overriding details that would show progress, but removing it would need to be tested.
Poster
Collaborator

Scratch thought of boost, although it could probably be used to update progress in UI. I know nothing about how it works but there are some things defined here:
https://git.hush.is/hush/hush3/src/branch/master/src/ui_interface.h

I did some testing and the "Rescanning..." and other status messaging on startup is returned as an error from getinfo here: https://git.hush.is/hush/SilentDragon/src/branch/master/src/connection.cpp#L514

It will return data like this if you check getinfo while rescanning.

error code: -28
error message:
Rescanning...

I could try calling getrescaninfo within showInformation to update progress but it might not work well.

Scratch thought of boost, although it could probably be used to update progress in UI. I know nothing about how it works but there are some things defined here: https://git.hush.is/hush/hush3/src/branch/master/src/ui_interface.h I did some testing and the "Rescanning..." and other status messaging on startup is returned as an error from `getinfo` here: https://git.hush.is/hush/SilentDragon/src/branch/master/src/connection.cpp#L514 It will return data like this if you check `getinfo` while rescanning. ``` error code: -28 error message: Rescanning... ``` I could try calling `getrescaninfo` within showInformation to update progress but it might not work well.
Owner

With the latest commit to dev branch, there is now a rescanTimer which is always running, so it should notice if the node is rescanning, even if done from hush-cli or if SD is restarted while hushd is still rescanning. I am going to test this a bit more before closing this issue, since there seems to be some small issues with how often it updates the statusbar text about rescan progress.

With the latest commit to dev branch, there is now a `rescanTimer` which is always running, so it should notice if the node is rescanning, even if done from hush-cli or if SD is restarted while hushd is still rescanning. I am going to test this a bit more before closing this issue, since there seems to be some small issues with how often it updates the statusbar text about rescan progress.
duke self-assigned this 2 years ago
Owner

Here is something I noticed that I wanted to document somewhere: If you start a rescan in hushd, then restart SD, SD will "hang" with it's initial splash screen, because it calls "getinfo" to see if it has a valid connection, but "getinfo" either returns an error during the hushd startup phase OR hangs if the rescan isn't complete yet. So SD doesn't render to the user that a rescan is happening. But if called "getrescaninfo" it would tell us that the node is rescanning, and we could update either the statusbar and/or give a popup of something like "Your node is rescanning, etc..."

Here is something I noticed that I wanted to document somewhere: If you start a rescan in hushd, then restart SD, SD will "hang" with it's initial splash screen, because it calls "getinfo" to see if it has a valid connection, but "getinfo" either returns an error during the hushd startup phase OR hangs if the rescan isn't complete yet. So SD doesn't render to the user that a rescan is happening. But if called "getrescaninfo" it would tell us that the node is rescanning, and we could update either the statusbar and/or give a popup of something like "Your node is rescanning, etc..."
duke added the
bug
label 1 year ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.