Skip to content

Commit

Permalink
check if expired program is on the same fork
Browse files Browse the repository at this point in the history
  • Loading branch information
pgarg66 authored Apr 4, 2023
1 parent 03955cb commit 1fbd74a
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions program-runtime/src/loaded_programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,22 +317,24 @@ impl LoadedPrograms {
if let Some(second_level) = self.entries.get(&key) {
for entry in second_level.iter().rev() {
let current_slot = working_slot.current_slot();
if entry
.maybe_expiration_slot
.map(|expiration_slot| current_slot >= expiration_slot)
.unwrap_or(false)
if current_slot == entry.deployment_slot
|| working_slot.is_ancestor(entry.deployment_slot)
{
// Found an entry that's already expired. Any further entries in the list
// are older than the current one. So treat the program as missing in the
// cache and return early.
missing.push(key);
return None;
}
if current_slot >= entry.effective_slot
&& (current_slot == entry.deployment_slot
|| working_slot.is_ancestor(entry.deployment_slot))
{
return Some((key, entry.clone()));
if entry
.maybe_expiration_slot
.map(|expiration_slot| current_slot >= expiration_slot)
.unwrap_or(false)
{
// Found an entry that's already expired. Any further entries in the list
// are older than the current one. So treat the program as missing in the
// cache and return early.
missing.push(key);
return None;
}

if current_slot >= entry.effective_slot {
return Some((key, entry.clone()));
}
}
}
}
Expand Down

0 comments on commit 1fbd74a

Please sign in to comment.