bitkit icon indicating copy to clipboard operation
bitkit copied to clipboard

Lag when restoring wallet and lag displaying funds onchain and on Lightning

Open thisispav opened this issue 1 year ago • 2 comments

Describe the bug

Can lead to confusion of users - did a restore (which was quite slow, compared to previous versions) initially when wallet is restored, initially there is no indication I have funds, now with the recorded version I do have funds onchain, but there is a lag when displaying the funds on LN).

Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Screenshots / Recording

https://github.com/synonymdev/bitkit/assets/119061223/f54a2d67-e158-49d8-b631-6971d0519e56

Operating system

Graphene OS Pixel 6A

Bitkit version

v113

Log output

No response

thisispav avatar Apr 12 '24 13:04 thisispav

logs attached bitkit_ldk_logs_1712928094902.zip

thisispav avatar Apr 12 '24 13:04 thisispav

Pav: The video attached is me restoring for the 2nd time and this time was considerably faster

thisispav avatar Apr 12 '24 13:04 thisispav

For me, this is much worse than in @thisispav's recording, with a regtest wallet.

I run on latest master and quite often it doesn't completely succeed, I do get the 'Wallet Restored' confirmation screen, but after I tap on the OK button, the app stays completely black while the logs keep getting spammed with errors related to Electrum connection.

My Wallet Restore Logs
 LOG  Running "bitkit" with {"rootTag":11}
 LOG  Wiping app data...
 LOG  [Error: Folder does not exist]
 LOG  Syncing Wallet...
 LOG  [TypeError: Cannot read property 'refreshWallet' of undefined]
 LOG  Connection to Electrum Server lost, reconnecting...
 LOG  [Error: close connect]
 LOG  [Error: close connect]
 LOG  [Error: close connect]
 LOG  [Error: close connect]
 LOG  [Error: close connect]
 LOG  [Error: close connect]
 LOG  [Error: close connect]
 LOG  [Error: close connect]
 LOG  [Error: close connect]
 LOG  [Error: close connect]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Connection to server lost, please retry]
 LOG  [Error: Connection to server lost, please retry]
 LOG  [Error: Connection to server lost, please retry]
 LOG  [Error: Connection to server lost, please retry]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: No LDK account found.]
 LOG  [Error: No LDK account found.]
 DEBUG  Sent hypercores to seeder
 LOG  true
 WARN  Restoring bitcoin from deprecated backup server.
 LOG  [Error: No LDK account found.]
 LOG  Connection to Electrum Server lost, reconnecting...
 WARN  Restoring bitcoinTestnet from deprecated backup server.
 LOG  [Error: No LDK account found.]
 LOG  [Error: com.reactnativeldk.classes.MissingBackup: Retrieve failed. Missing backup.]
 LOG  [Error: com.reactnativeldk.classes.MissingBackup: Retrieve failed. Missing backup.]
 LOG  Error restoring widgets com.reactnativeldk.classes.MissingBackup: Retrieve failed. Missing backup.
 LOG  [Error: com.reactnativeldk.classes.MissingBackup: Retrieve failed. Missing backup.]
 LOG  [Error: com.reactnativeldk.classes.MissingBackup: Retrieve failed. Missing backup.]
 LOG  Error restoring metadata com.reactnativeldk.classes.MissingBackup: Retrieve failed. Missing backup.
 LOG  [Error: com.reactnativeldk.classes.MissingBackup: Retrieve failed. Missing backup.]
 LOG  [Error: com.reactnativeldk.classes.MissingBackup: Retrieve failed. Missing backup.]
 LOG  Error restoring slashtags com.reactnativeldk.classes.MissingBackup: Retrieve failed. Missing backup.
 LOG  [Error: com.reactnativeldk.classes.MissingBackup: Retrieve failed. Missing backup.]
 LOG  [Error: com.reactnativeldk.classes.MissingBackup: Retrieve failed. Missing backup.]
 LOG  Error restoring activity com.reactnativeldk.classes.MissingBackup: Retrieve failed. Missing backup.
 LOG  Connection to Electrum Server lost, reconnecting...
 LOG  [Error: close connect]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Failed Electrum connection check.]
 LOG  true
 LOG  Connection to Electrum Server lost, reconnecting...
 LOG  Connection to Electrum Server lost, reconnecting...
 LOG  [Error: close connect]
 LOG  [Error: close connect]
 LOG  [Error: Connection to server lost, please retry]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Failed Electrum connection check.]
 LOG  [Error: Failed Electrum connection check.]
 LOG  true
 LOG  Connection to Electrum Server lost, reconnecting...
 LOG  Connection to Electrum Server lost, reconnecting...
 LOG  Connection to Electrum Server lost, reconnecting...

I have to restart the app after restore, because it hangs on black screen.

Then it loads the (wallet) home page correctly and I can manually fix the Electrum connection (sometimes) from Settings → Advanced → Electrum Server, tapping Connect to Host.

ovitrif avatar Apr 30 '24 16:04 ovitrif

Same issue also restoring a mainnet wallet, tested to confirm this isn't related to our electrum server for regtest.

ovitrif avatar Apr 30 '24 17:04 ovitrif

Closing this in favour of:

  • #1723

Seem to be more or less the same issue, and that one describes a more critical problem.

ovitrif avatar Apr 30 '24 17:04 ovitrif

This issue is specifically about the delay of correct spending balance showing after wallet restore, which could still be an issue after the "indefinitely black screen" bug is resolved.

Perhaps the fix here is to not display 0 for any balance when it is still waiting for the data response.

catch-21 avatar May 01 '24 10:05 catch-21

Went over this w/ @JeanlChristophe and @catch-21 and we propose to never show zero unless the balance is truly zero.

We'll foresee an indication that balance is loading for users.

ovitrif avatar May 02 '24 09:05 ovitrif

With the new design, the dollar value is a dash when the bitcoin balance is zero. The dollar value should also be zero in this scenario but the dash could be used to indicate the balance has not yet been determined.

catch-21 avatar May 02 '24 09:05 catch-21

#1773 might fix the issue

limpbrains avatar May 06 '24 11:05 limpbrains

#1773 does does indeed appear to have solved this issue. However, it now doesn't load the wallet until all data has been retrieved, which can take a while in some network conditions, see https://github.com/synonymdev/bitkit/issues/1806.

catch-21 avatar May 08 '24 15:05 catch-21