Ensure that `extended_range` in `scan_complete` is a superset of `range`

Previously `extended_range` only covered the extent of the leaves of
all subtrees in which notes were found during a scan. When the scanned
range was large, this was not guaranteed to be contained within the
subtree leaves, causing an assertion failure when an invalid `ScanRange`
was constructed.
This commit is contained in:
Jack Grigg 2023-07-13 01:02:27 +00:00
parent cb887efa06
commit 281dbd5524
1 changed files with 2 additions and 2 deletions

View File

@ -569,8 +569,8 @@ pub(crate) fn scan_complete<P: consensus::Parameters>(
let range_max = sapling_shard_end(*max_idx)?;
Ok::<Range<BlockHeight>, rusqlite::Error>(Range {
start: range_min.unwrap_or(range.start),
end: range_max.unwrap_or(range.end),
start: range.start.min(range_min.unwrap_or(range.start)),
end: range.end.max(range_max.unwrap_or(range.end)),
})
})
.transpose()