Skip to content

Commit

Permalink
move invalid id check to pre-load
Browse files Browse the repository at this point in the history
  • Loading branch information
eaypek-tfh committed Jan 10, 2025
1 parent 6972e3a commit 8852eac
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions iris-mpc/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,10 @@ async fn server_main(config: Config) -> eyre::Result<()> {
time_waiting_for_stream += now_load_summary.elapsed();
now_load_summary = Instant::now();
let index = result.index();
if index == 0 || index > store_len {
tracing::error!("Invalid iris index {}", index);
return Err(eyre!("Invalid iris index {}", index));
}
match result {
StoredIris::DB(iris) => {
n_loaded_from_db += 1;
Expand Down Expand Up @@ -1128,11 +1132,6 @@ async fn server_main(config: Config) -> eyre::Result<()> {
);
}

if index == 0 || index > store_len {
tracing::error!("Invalid iris index {}", index);
return Err(eyre!("Invalid iris index {}", index));
}

// if the serial id hasn't been loaded before, count is as unique record
if all_serial_ids.contains(&(index as i64)) {
actor.increment_db_size(index - 1);
Expand Down

0 comments on commit 8852eac

Please sign in to comment.