Skip to content

Commit

Permalink
Deduplicate sat range summation logic (#2402)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Aug 31, 2023
1 parent 329f31b commit 9b8a4bf
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions src/index/updater/inscription_updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,23 +398,13 @@ impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'db, 'tx> {
let sat = if unbound {
None
} else {
let mut sat = None;
if let Some(input_sat_ranges) = input_sat_ranges {
let mut offset = 0;
for (start, end) in input_sat_ranges {
let size = end - start;
if offset + size > flotsam.offset {
let n = start + flotsam.offset - offset;
self.sat_to_inscription_id.insert(&n, &inscription_id)?;
sat = Some(Sat(n));
break;
}
offset += size;
}
}
sat
Self::calculate_sat(input_sat_ranges, flotsam.offset)
};

if let Some(Sat(n)) = sat {
self.sat_to_inscription_id.insert(&n, &inscription_id)?;
}

self.id_to_entry.insert(
&inscription_id,
&InscriptionEntry {
Expand Down

0 comments on commit 9b8a4bf

Please sign in to comment.