mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 21:34:46 +00:00
merge upstream/unstable
This commit is contained in:
@@ -402,7 +402,7 @@ impl<T: AggregateMap> NaiveAggregationPool<T> {
|
||||
|
||||
/// Returns the total number of items stored in `self`.
|
||||
pub fn num_items(&self) -> usize {
|
||||
self.maps.iter().map(|(_, map)| map.len()).sum()
|
||||
self.maps.values().map(T::len).sum()
|
||||
}
|
||||
|
||||
/// Returns an aggregated `T::Value` with the given `T::Data`, if any.
|
||||
@@ -448,11 +448,7 @@ impl<T: AggregateMap> NaiveAggregationPool<T> {
|
||||
// If we have too many maps, remove the lowest amount to ensure we only have
|
||||
// `SLOTS_RETAINED` left.
|
||||
if self.maps.len() > SLOTS_RETAINED {
|
||||
let mut slots = self
|
||||
.maps
|
||||
.iter()
|
||||
.map(|(slot, _map)| *slot)
|
||||
.collect::<Vec<_>>();
|
||||
let mut slots = self.maps.keys().copied().collect::<Vec<_>>();
|
||||
// Sort is generally pretty slow, however `SLOTS_RETAINED` is quite low so it should be
|
||||
// negligible.
|
||||
slots.sort_unstable();
|
||||
|
||||
@@ -1459,7 +1459,7 @@ where
|
||||
let proposer_index = state.get_beacon_proposer_index(slot, &self.spec).unwrap();
|
||||
|
||||
let signed_block = block.sign(
|
||||
&self.validator_keypairs[proposer_index as usize].sk,
|
||||
&self.validator_keypairs[proposer_index].sk,
|
||||
&state.fork(),
|
||||
state.genesis_validators_root(),
|
||||
&self.spec,
|
||||
|
||||
@@ -631,10 +631,7 @@ impl<T: EthSpec> ValidatorMonitor<T> {
|
||||
|
||||
// Return the `id`'s of all monitored validators.
|
||||
pub fn get_all_monitored_validators(&self) -> Vec<String> {
|
||||
self.validators
|
||||
.iter()
|
||||
.map(|(_, val)| val.id.clone())
|
||||
.collect()
|
||||
self.validators.values().map(|val| val.id.clone()).collect()
|
||||
}
|
||||
|
||||
/// If `self.auto_register == true`, add the `validator_index` to `self.monitored_validators`.
|
||||
|
||||
Reference in New Issue
Block a user