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,6 +1,8 @@
use crate::*;
use ssz::{Decode, Encode};
mod beacon_state;
impl StoreItem for BeaconBlock {
fn db_column() -> DBColumn {
DBColumn::BeaconBlock
@@ -14,17 +16,3 @@ impl StoreItem for BeaconBlock {
Self::from_ssz_bytes(bytes).map_err(Into::into)
}
}
impl<T: EthSpec> StoreItem for BeaconState<T> {
fn db_column() -> DBColumn {
DBColumn::BeaconState
}
fn as_store_bytes(&self) -> Vec<u8> {
self.as_ssz_bytes()
}
fn from_store_bytes(bytes: &mut [u8]) -> Result<Self, Error> {
Self::from_ssz_bytes(bytes).map_err(Into::into)
}
}