Merge branch 'full_scan_fix' into grim

This commit is contained in:
ardocrat
2026-05-14 21:37:11 +03:00
+20 -5
View File
@@ -980,18 +980,23 @@ where
// Scan every 10k heights to save data between batches in case of interruption.
let mut total_pmmr_range = None;
for h in (start_height..tip.0).step_by(10001) {
let batch_end_height = cmp::min(tip.0, h + 10000);
let (mut info, range) = scan::scan(
wallet_inst.clone(),
keychain_mask,
delete_unconfirmed,
h,
cmp::min(tip.0, h + 10000),
batch_end_height,
start_height,
tip.0,
total_pmmr_range,
status_send_channel,
)?;
info.hash = tip.1.clone();
info.hash = if batch_end_height == tip.0 {
tip.1.clone()
} else {
"".to_owned()
};
total_pmmr_range = Some(range);
wallet_lock!(wallet_inst, w);
@@ -1038,6 +1043,9 @@ where
}
}
/// Wallet scan window in blocks (48 hours).
pub const REORG_RESCAN_WINDOW: u64 = 24 * 60 * 2;
/// Experimental, wrap the entire definition of how a wallet's state is updated
pub fn update_wallet_state<'a, L, C, K>(
wallet_inst: Arc<Mutex<Box<dyn WalletInst<'a, L, C, K>>>>,
@@ -1126,7 +1134,9 @@ where
}
};
let start_height = last_scanned_block.height.saturating_sub(100);
let start_height = last_scanned_block
.height
.saturating_sub(REORG_RESCAN_WINDOW);
debug!(
"update_wallet_state: last_scanned_block: {:?}",
@@ -1143,18 +1153,23 @@ where
// Scan every 10k heights to save data between batches in case of interruption.
let mut total_pmmr_range = None;
for h in (start_height..tip.0).step_by(10001) {
let batch_end_height = cmp::min(tip.0, h + 10000);
let (mut info, range) = scan::scan(
wallet_inst.clone(),
keychain_mask,
false,
h,
cmp::min(tip.0, h + 10000),
batch_end_height,
start_height,
tip.0,
total_pmmr_range,
status_send_channel,
)?;
info.hash = tip.1.clone();
info.hash = if batch_end_height == tip.0 {
tip.1.clone()
} else {
"".to_owned()
};
total_pmmr_range = Some(range);
wallet_lock!(wallet_inst, w);