mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-27 01:33:33 +00:00
Faster BeaconState enc/dec (#671)
* Add state enc/dec benches * Add example for flamegraph * Use `PublicKeyBytes` for `Validator` * Ripple PublicKeyBytes change through codebase * Add benches, optimizations to store BeaconState * Store BeaconState in StorageContainer too * Optimize StorageContainer with std::mem magic * Fix rest_api tests
This commit is contained in:
@@ -454,7 +454,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
/// Returns the validator index (if any) for the given public key.
|
||||
///
|
||||
/// Information is retrieved from the present `beacon_state.validators`.
|
||||
pub fn validator_index(&self, pubkey: &PublicKey) -> Option<usize> {
|
||||
pub fn validator_index(&self, pubkey: &PublicKeyBytes) -> Option<usize> {
|
||||
for (i, validator) in self.head().beacon_state.validators.iter().enumerate() {
|
||||
if validator.pubkey == *pubkey {
|
||||
return Some(i);
|
||||
|
||||
Reference in New Issue
Block a user