mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 13:28:33 +00:00
Update Rust Edition to 2024 (#7766)
* #7749 Thanks @dknopik and @michaelsproul for your help!
This commit is contained in:
@@ -12,7 +12,7 @@ use slot_clock::SlotClock;
|
||||
use smallvec::SmallVec;
|
||||
use state_processing::common::get_attestation_participation_flag_indices;
|
||||
use state_processing::per_epoch_processing::{
|
||||
errors::EpochProcessingError, EpochProcessingSummary,
|
||||
EpochProcessingSummary, errors::EpochProcessingError,
|
||||
};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::io;
|
||||
@@ -163,7 +163,7 @@ impl EpochSummary {
|
||||
/// - It is `None`.
|
||||
/// - `new` is greater than its current value.
|
||||
fn update_if_lt<T: Ord>(current: &mut Option<T>, new: T) {
|
||||
if let Some(ref mut current) = current {
|
||||
if let Some(current) = current {
|
||||
if new < *current {
|
||||
*current = new
|
||||
}
|
||||
@@ -460,11 +460,12 @@ impl<E: EthSpec> ValidatorMonitor<E> {
|
||||
let unaggregated_attestations = &mut self.unaggregated_attestations;
|
||||
|
||||
// Pruning, this removes the oldest key/pair of the hashmap if it's greater than MAX_UNAGGREGATED_ATTESTATION_HASHMAP_LENGTH
|
||||
if unaggregated_attestations.len() >= MAX_UNAGGREGATED_ATTESTATION_HASHMAP_LENGTH {
|
||||
if let Some(oldest_slot) = unaggregated_attestations.keys().min().copied() {
|
||||
unaggregated_attestations.remove(&oldest_slot);
|
||||
}
|
||||
if unaggregated_attestations.len() >= MAX_UNAGGREGATED_ATTESTATION_HASHMAP_LENGTH
|
||||
&& let Some(oldest_slot) = unaggregated_attestations.keys().min().copied()
|
||||
{
|
||||
unaggregated_attestations.remove(&oldest_slot);
|
||||
}
|
||||
|
||||
let slot = attestation.data().slot;
|
||||
self.unaggregated_attestations.insert(slot, attestation);
|
||||
}
|
||||
@@ -1095,19 +1096,19 @@ impl<E: EthSpec> ValidatorMonitor<E> {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(pubkey) = self.indices.get(&validator_index) {
|
||||
if !self.validators.contains_key(pubkey) {
|
||||
info!(
|
||||
%pubkey,
|
||||
validator = %validator_index,
|
||||
"Started monitoring validator"
|
||||
);
|
||||
if let Some(pubkey) = self.indices.get(&validator_index)
|
||||
&& !self.validators.contains_key(pubkey)
|
||||
{
|
||||
info!(
|
||||
%pubkey,
|
||||
validator = %validator_index,
|
||||
"Started monitoring validator"
|
||||
);
|
||||
|
||||
self.validators.insert(
|
||||
*pubkey,
|
||||
MonitoredValidator::new(*pubkey, Some(validator_index)),
|
||||
);
|
||||
}
|
||||
self.validators.insert(
|
||||
*pubkey,
|
||||
MonitoredValidator::new(*pubkey, Some(validator_index)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user