diff --git a/libwallet/src/api_impl/owner.rs b/libwallet/src/api_impl/owner.rs index 9fc556a..951d0d6 100644 --- a/libwallet/src/api_impl/owner.rs +++ b/libwallet/src/api_impl/owner.rs @@ -1111,21 +1111,13 @@ where let last_scanned_block = { wallet_lock!(wallet_inst, w); match w.init_status()? { - WalletInitStatus::InitNeedsScanning => { - w.last_scanned_block().unwrap_or(ScannedBlockInfo { - height: 0, - hash: "".to_owned(), - start_pmmr_index: 0, - last_pmmr_index: 0, - }) - } WalletInitStatus::InitNoScanning => ScannedBlockInfo { height: tip.clone().0, hash: tip.clone().1, start_pmmr_index: 0, last_pmmr_index: 0, }, - WalletInitStatus::InitComplete => w.last_scanned_block()?, + _ => w.last_scanned_block()?, } }; diff --git a/libwallet/src/internal/scan.rs b/libwallet/src/internal/scan.rs index 92efceb..a6dcc92 100644 --- a/libwallet/src/internal/scan.rs +++ b/libwallet/src/internal/scan.rs @@ -231,6 +231,7 @@ fn collect_chain_outputs<'a, L, C, K>( keychain_mask: &Option<&SecretKey>, keychain: &K, client: C, + start_height: u64, start_index: u64, end_index: Option, status_send_channel: &Option>, @@ -274,15 +275,15 @@ where keychain, outputs.clone(), status_send_channel, - perc_complete as u8, + perc_complete, )?); - // Save last scanned block info. + // Save last scanned block info to continue from same index in case of interruption. { wallet_lock!(wallet_inst, w); let mut batch = w.batch(*keychain_mask)?; batch.save_last_scanned_block(ScannedBlockInfo { - height: 0, + height: start_height, hash: "".to_string(), start_pmmr_index: start_index, last_pmmr_index: last_retrieved_index, @@ -511,6 +512,7 @@ where &keychain_mask, &keychain, client, + start_height, start_pmmr_index, Some(pmmr_range.1), status_send_channel,