replace max_peers cli argument by target_peers and use excess peers above target_peers capped by a new constant PEER_EXCESS_FACTOR (relative to target_peers) (#1383)

This commit is contained in:
blacktemplar
2020-07-23 05:55:36 +02:00
committed by GitHub
parent 3a888d6ef3
commit 3c4daec9af
9 changed files with 113 additions and 21 deletions

View File

@@ -63,6 +63,11 @@ impl<T: EthSpec> PeerInfo<T> {
}
false
}
/// Reports if this peer has some future validator duty in which case it is valuable to keep it.
pub fn has_future_duty(&self) -> bool {
self.min_ttl.map_or(false, |i| i >= Instant::now())
}
}
#[derive(Clone, Debug, Serialize)]