Skip to content

Commit

Permalink
Print only unique doppelgangers (#2500)
Browse files Browse the repository at this point in the history
## Issue Addressed

N/A

## Proposed Changes

This is just a cosmetic change to print only the unique list of violaters. We could repeat violaters in the list if an attestation and aggregation both were detected from the same validator.
  • Loading branch information
pawanjay176 committed Aug 5, 2021
1 parent fc89693 commit 350b6f1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions validator_client/src/doppelganger_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use eth2::types::LivenessResponseData;
use parking_lot::RwLock;
use slog::{crit, error, info, Logger};
use slot_clock::SlotClock;
use std::collections::HashMap;
use std::collections::{HashMap, HashSet};
use std::future::Future;
use std::sync::Arc;
use task_executor::ShutdownReason;
Expand Down Expand Up @@ -505,7 +505,7 @@ impl DoppelgangerService {
//
// A following loop will update the states of each validator, depending on whether or not
// any violators were detected here.
let mut violators = vec![];
let mut violators = HashSet::new();
for response in previous_epoch_responses
.iter()
.chain(current_epoch_responses.iter())
Expand Down Expand Up @@ -541,7 +541,7 @@ impl DoppelgangerService {
};

if response.is_live && next_check_epoch <= response.epoch {
violators.push(response.index);
violators.insert(response.index);
}
}

Expand Down

0 comments on commit 350b6f1

Please sign in to comment.