mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
Clippy 1.49.0 updates and dht persistence test fix (#2156)
## Issue Addressed `test_dht_persistence` failing ## Proposed Changes Bind `NetworkService::start` to an underscore prefixed variable rather than `_`. `_` was causing it to be dropped immediately This was failing 5/100 times before this update, but I haven't been able to get it to fail after updating it Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
@@ -70,16 +70,16 @@ impl<TSpec: EthSpec> PeerScoreSettings<TSpec> {
|
||||
enr_fork_id: &EnrForkId,
|
||||
current_slot: Slot,
|
||||
) -> error::Result<PeerScoreParams> {
|
||||
let mut params = PeerScoreParams::default();
|
||||
|
||||
params.decay_interval = self.decay_interval;
|
||||
params.decay_to_zero = self.decay_to_zero;
|
||||
params.retain_score = self.epoch * 100;
|
||||
params.app_specific_weight = 1.0;
|
||||
params.ip_colocation_factor_threshold = 3.0;
|
||||
params.behaviour_penalty_threshold = 6.0;
|
||||
|
||||
params.behaviour_penalty_decay = self.score_parameter_decay(self.epoch * 10);
|
||||
let mut params = PeerScoreParams {
|
||||
decay_interval: self.decay_interval,
|
||||
decay_to_zero: self.decay_to_zero,
|
||||
retain_score: self.epoch * 100,
|
||||
app_specific_weight: 1.0,
|
||||
ip_colocation_factor_threshold: 3.0,
|
||||
behaviour_penalty_threshold: 6.0,
|
||||
behaviour_penalty_decay: self.score_parameter_decay(self.epoch * 10),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let target_value = Self::decay_convergence(
|
||||
params.behaviour_penalty_decay,
|
||||
|
||||
@@ -97,7 +97,7 @@ impl<T: EthSpec> PeerInfo<T> {
|
||||
}
|
||||
|
||||
/// Returns the seen IP addresses of the peer.
|
||||
pub fn seen_addresses<'a>(&'a self) -> impl Iterator<Item = IpAddr> + 'a {
|
||||
pub fn seen_addresses(&self) -> impl Iterator<Item = IpAddr> + '_ {
|
||||
self.seen_addresses
|
||||
.iter()
|
||||
.map(|socket_addr| socket_addr.ip())
|
||||
|
||||
@@ -29,14 +29,12 @@ pub struct SyncInfo {
|
||||
|
||||
impl std::cmp::PartialEq for PeerSyncStatus {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(PeerSyncStatus::Synced { .. }, PeerSyncStatus::Synced { .. }) => true,
|
||||
(PeerSyncStatus::Advanced { .. }, PeerSyncStatus::Advanced { .. }) => true,
|
||||
(PeerSyncStatus::Behind { .. }, PeerSyncStatus::Behind { .. }) => true,
|
||||
(PeerSyncStatus::IrrelevantPeer, PeerSyncStatus::IrrelevantPeer) => true,
|
||||
(PeerSyncStatus::Unknown, PeerSyncStatus::Unknown) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!((self, other),
|
||||
(PeerSyncStatus::Synced { .. }, PeerSyncStatus::Synced { .. }) |
|
||||
(PeerSyncStatus::Advanced { .. }, PeerSyncStatus::Advanced { .. }) |
|
||||
(PeerSyncStatus::Behind { .. }, PeerSyncStatus::Behind { .. }) |
|
||||
(PeerSyncStatus::IrrelevantPeer, PeerSyncStatus::IrrelevantPeer) |
|
||||
(PeerSyncStatus::Unknown, PeerSyncStatus::Unknown))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,14 +23,12 @@ pub enum SyncState {
|
||||
|
||||
impl PartialEq for SyncState {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(SyncState::SyncingFinalized { .. }, SyncState::SyncingFinalized { .. }) => true,
|
||||
(SyncState::SyncingHead { .. }, SyncState::SyncingHead { .. }) => true,
|
||||
(SyncState::Synced, SyncState::Synced) => true,
|
||||
(SyncState::Stalled, SyncState::Stalled) => true,
|
||||
(SyncState::SyncTransition, SyncState::SyncTransition) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!((self, other),
|
||||
(SyncState::SyncingFinalized { .. }, SyncState::SyncingFinalized { .. }) |
|
||||
(SyncState::SyncingHead { .. }, SyncState::SyncingHead { .. }) |
|
||||
(SyncState::Synced, SyncState::Synced) |
|
||||
(SyncState::Stalled, SyncState::Stalled) |
|
||||
(SyncState::SyncTransition, SyncState::SyncTransition))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user