synonymdev / bitkit

Self-custodial Bitcoin and Lightning Wallet for Android and iOS.
https://bitkit.to
MIT License
117 stars 21 forks source link

[Bug]: Black screen displayed indefinitely on wallet restore #1723

Closed catch-21 closed 6 months ago

catch-21 commented 7 months ago

Describe the bug

When restoring a wallet, after the rock ship animation screen and confirmation that restore was successful but before the main wallet screen loads, a black screen is displayed indefinitely. At this stage the app must be fully closed and reopened to progress to the wallet.

Reproduce

  1. Start Bitkit with no app data
  2. Enter valid seed phrase to recover wallet
  3. Wait for "Setting up your Wallet" screen to pass and "Wallet Restored" to display
  4. Tap "Get Started" button
  5. Observe black screen forever.

Screenshots / Recording

https://github.com/synonymdev/bitkit/assets/74595920/d1e06577-232d-4efe-bde1-eba6da0ea6e6

(black screen at the end will persist for longer)

Operating system

Android 13 TKQ1.220829.002

Bitkit version

c55c045f58b7e76ee82acdc1419bccf9db8490ae

Log output

No response

catch-21 commented 6 months ago

This isn't an issue for me now with branch release-115 https://github.com/synonymdev/bitkit/commit/9ff423802faacd24a2e5f8fac7e31edd381c5ba6

catch-21 commented 6 months ago

This is an issue for me again using https://github.com/synonymdev/bitkit/commit/5cb45a6b2b23936d8d4037525e5b5792180847b7 I built myself

ovitrif commented 6 months ago

I'll pick this up since it seems to be duplicated by #1650 which was assigned to me, judging by flow it repros in.

Here's the info I transfer from my investigation of the duplicate which I closed:

  1. Bug occurs both on regtest (with regtest wallet) and mainnet (mainnet wallet)
  2. Errors with electrum connection are spammed in the logs while on the black screen.
  3. A force close and reopen of the app doesn't necessarily fixes the electrum connection issues, most often in Advanced Settings → Electrum Server the connection still shows offline.
    • Tapping on Connect to host usually re-establishes the connection, but on a 50/50 basis it will disconnect again.
  4. I get this on the latest commit in master
    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...

ovitrif commented 6 months ago

Parked to prioritise:

This would still need to be completed before next release from master.

catch-21 commented 6 months ago

Tested on b47d58d89e810df89be21509462b8e22490d7c0a LGTM. Thank you!