opened
mrfelton
username_0
## Description

Sync process hangs at 99% for a long time when recovering a wallet whist lnd scans blocks for recoverable addresses.

## Expected Behavior

Sync screen should factor in the additional time it takes to scan old blocks for recoverable addresses.

## Actual Behavior

Sync screen hangs at 99% whilst old blocks are scanned.

Log output from lnd shows what is happening in the background:

```
  zap:lnd [INF]  2019-04-22 13:04:08.973 [INF] LNWL: RECOVERY MODE ENABLED -- rescanning for used addresses with recovery_window=250 +759ms
  zap:lnd [INF]  2019-04-22 13:04:08.983 [INF] LNWL: Seed birthday surpassed, starting recovery of wallet from height=567221 hash=0000000000000000002e2998f76507736d96df2f2cb45a744795d7316bea2b8a with recovery-window=250 +10ms
  zap:lnd [INF]  2019-04-22 13:04:08.996 [INF] LNWL: Scanning 780 blocks for recoverable addresses +13ms
  zap:lnd [INF]  2019-04-22 13:04:12.097 [INF] BTCN: Waiting for more block headers, then will start cfheaders sync from height 570000... +3s
  zap:lnd [INF]  2019-04-22 13:04:12.097 [INF] BTCN: Starting cfheaders sync from (block_height=570000, block_hash=0000000000000000000822cf76247f1ecec0a82dbecb3b482ec4d2d154e0cd1d) to (block_height=572746, block_hash=000000000000000000281a467a2f64f5b0283f9fd40c0bc3678776d33cf75723) +1ms
  zap:lnd [INF]  2019-04-22 13:04:12.099 [INF] BTCN: Starting cfheaders sync for filter_type=0 +2ms
  zap:lnd [INF]  2019-04-22 13:04:12.227 [INF] BTCN: Fetching set of checkpointed cfheaders filters from height=570000, hash=620f1c748b3965f3e8eed33d74bbaead8b2b584a028a7040f202277817ffbd5c +127ms
  zap:lnd [INF]  2019-04-22 13:04:12.227 [INF] BTCN: Starting to query for cfheaders from checkpoint_interval=570 +1ms
  zap:lnd [INF]  2019-04-22 13:04:12.227 [INF] BTCN: Attempting to query for 2 cfheader batches +0ms
  zap:lnd [INF]  2019-04-22 13:04:12.687 [INF] BTCN: Verified 83000 filter headers in the last 12.22s (height 570001, 2019-04-03 11:22:56 +0200 CEST) +460ms
  zap:main [INF]  Sending message to renderer process: { msg: 'lndCfilterHeight', data: 570001 } +0ms
  zap:lnd [INF]  2019-04-22 13:04:15.714 [INF] BTCN: Fully caught up with cfheaders at height 572746, waiting at tip for new blocks +3s
  zap:lnd [INF]  2019-04-22 13:04:15.715 [INF] BTCN: Attempting to fetch set of un-checkpointed filters at height=572746, hash=000000000000000000281a467a2f64f5b0283f9fd40c0bc3678776d33cf75723 +0ms
  zap:lnd [INF]  2019-04-22 13:07:07.455 [INF] LNWL: Recovered addresses from blocks 567221-568000 +3m
  zap:lnd [INF]  2019-04-22 13:07:07.613 [INF] LNWL: Scanning 2000 blocks for recoverable addresses +157ms
  zap:lnd [INF]  2019-04-22 13:08:27.351 [INF] LNWL: Fetching block height=568358 hash=0000000000000000001e2c52b041dc46c93a00a6e123ac6ff2935beb31469b90 +1m
  zap:lnd [INF]  2019-04-22 13:08:51.196 [INF] LNWL: Fetching block height=568457 hash=0000000000000000001e4cb64e17b65f2654e5807a2cb5845c3def034d8a54df +24s
```
 
## Possible Fix

Factor recovery process into the sync progress calculations and progress bar display

## Steps to Reproduce

Import an old wallet and monitor the lnd logs whist the sync is happening.

## Your Environment

- Zap version: 0.4.1
- Operating System and version: all
Sync process hangs at 99% for a long time when recovering a wallet whist lnd scans blocks for recoverable addresses
issue
closed
mrfelton
username_0
issue
created
mrfelton
username_0
Closed via https://github.com/LN-Zap/zap-desktop/pull/2133
comment