Add fork choice persistence

This commit is contained in:
Paul Hauner
2019-11-29 16:45:27 +11:00
parent 864955e743
commit 7da8003f45
8 changed files with 34 additions and 20 deletions

View File

@@ -54,7 +54,7 @@ pub trait LmdGhost<S: Store, E: EthSpec>: Send + Sync + Sized {
fn verify_integrity(&self) -> Result<()>;
/// Encode the `LmdGhost` instance to bytes.
fn as_bytes(self) -> Vec<u8>;
fn as_bytes(&self) -> Vec<u8>;
/// Create a new `LmdGhost` instance given a `store` and encoded bytes.
fn from_bytes(bytes: &[u8], store: Arc<S>) -> Result<Self>;

View File

@@ -121,8 +121,8 @@ where
}
/// Consume the `ReducedTree` object and return its ssz encoded bytes representation.
fn as_bytes(self) -> Vec<u8> {
self.core.into_inner().as_bytes()
fn as_bytes(&self) -> Vec<u8> {
self.core.read().as_bytes()
}
/// Create a new `ThreadSafeReducedTree` instance from a `store` and the