Store beacon state committee cache in DB

This commit is contained in:
Paul Hauner
2019-06-04 13:13:58 +10:00
parent f530f5a848
commit 67fdb4a7fb
4 changed files with 70 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
use self::committee_cache::{get_active_validator_indices, CommitteeCache};
use self::committee_cache::get_active_validator_indices;
use self::exit_cache::ExitCache;
use crate::test_utils::TestRandom;
use crate::*;
@@ -15,6 +15,7 @@ use test_random_derive::TestRandom;
use tree_hash::TreeHash;
use tree_hash_derive::{CachedTreeHash, TreeHash};
pub use self::committee_cache::CommitteeCache;
pub use beacon_state_types::*;
mod beacon_state_types;

View File

@@ -2,6 +2,7 @@ use super::BeaconState;
use crate::*;
use core::num::NonZeroUsize;
use serde_derive::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode};
use std::ops::Range;
use swap_or_not_shuffle::shuffle_list;
@@ -9,7 +10,7 @@ mod tests;
/// Computes and stores the shuffling for an epoch. Provides various getters to allow callers to
/// read the committees for the given epoch.
#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize, Encode, Decode)]
pub struct CommitteeCache {
initialized_epoch: Option<Epoch>,
shuffling: Vec<usize>,