scan: save start height at scanned block info on outputs collecting

This commit is contained in:
ardocrat
2026-04-11 22:12:48 +03:00
parent 94d3eb3f38
commit 331df8b268
2 changed files with 6 additions and 12 deletions
+1 -9
View File
@@ -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()?,
}
};
+5 -3
View File
@@ -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<u64>,
status_send_channel: &Option<Sender<StatusMessage>>,
@@ -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,