zcash_client_sqlite: Fix off-by-one in `scan_complete`

Shard end heights are end-inclusive, while Rust `Range`s are
end-exclusive.

Co-authored-by: Kris Nuttycombe <kris@nutty.land>
This commit is contained in:
Jack Grigg 2023-09-08 03:44:03 +00:00
parent b54969953f
commit 7a4954c242
1 changed files with 3 additions and 2 deletions

View File

@ -674,8 +674,9 @@ pub(crate) fn scan_complete<P: consensus::Parameters>(
let range_min =
range_min.map(|h| wallet_birthday.map_or(h, |b| std::cmp::max(b, h)));
// get the block height for the end of the current shard
let range_max = sapling_shard_end(*max_idx)?;
// Get the block height for the end of the current shard, and make it an
// exclusive end bound.
let range_max = sapling_shard_end(*max_idx)?.map(|end| end + 1);
Ok::<Range<BlockHeight>, rusqlite::Error>(Range {
start: range.start.min(range_min.unwrap_or(range.start)),