Skip to content

Commit f141a6b

Browse files
fix: Add support for new data hash exclusions when update manifests are pr… (#1478)
Add support for new data hash exclusions when update manifests are present.
1 parent 4e9c3f2 commit f141a6b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

sdk/src/claim.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2581,16 +2581,31 @@ impl Claim {
25812581

25822582
// update with any needed update hash adjustments
25832583
if svi.update_manifest_label.is_some() {
2584+
let mut start_adjust = 0;
2585+
let mut start_offset = 0;
25842586
if let Some(exclusions) = &mut dh.exclusions {
25852587
if let Some(range) = &svi.manifest_store_range {
25862588
// find the range that starts at the same position as the manifest store range
25872589
if let Some(pos) =
25882590
exclusions.iter().position(|r| r.start() == range.start())
25892591
{
2592+
// find the adjustment length
2593+
start_offset = range.start();
2594+
start_adjust =
2595+
range.length().saturating_sub(exclusions[pos].length());
2596+
25902597
// replace range using the size that covers entire manifest (including update manifests)
25912598
exclusions[pos] = range.clone();
25922599
}
25932600
}
2601+
// fix up offsets affected by update manifest
2602+
if start_offset > 0 {
2603+
for exclusion in exclusions {
2604+
if exclusion.start() > start_offset {
2605+
exclusion.set_start(exclusion.start() + start_adjust);
2606+
}
2607+
}
2608+
}
25942609
}
25952610
}
25962611

0 commit comments

Comments
 (0)