mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-30 11:24:31 +00:00
Store states efficiently in the hot database (#746)
* Sparse hot DB and block root tree * Fix store_tests * Ensure loads of hot states on boundaries are fast * Milder error for unaligned finalized blocks
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
mod reduced_tree;
|
||||
|
||||
use std::sync::Arc;
|
||||
use store::Store;
|
||||
use store::{BlockRootTree, Store};
|
||||
use types::{BeaconBlock, EthSpec, Hash256, Slot};
|
||||
|
||||
pub use reduced_tree::ThreadSafeReducedTree;
|
||||
@@ -12,7 +12,12 @@ pub type Result<T> = std::result::Result<T, String>;
|
||||
// can remove it.
|
||||
pub trait LmdGhost<S: Store<E>, E: EthSpec>: PartialEq + Send + Sync + Sized {
|
||||
/// Create a new instance, with the given `store` and `finalized_root`.
|
||||
fn new(store: Arc<S>, finalized_block: &BeaconBlock<E>, finalized_root: Hash256) -> Self;
|
||||
fn new(
|
||||
store: Arc<S>,
|
||||
block_root_tree: Arc<BlockRootTree>,
|
||||
finalized_block: &BeaconBlock<E>,
|
||||
finalized_root: Hash256,
|
||||
) -> Self;
|
||||
|
||||
/// Process an attestation message from some validator that attests to some `block_hash`
|
||||
/// representing a block at some `block_slot`.
|
||||
@@ -59,5 +64,6 @@ pub trait LmdGhost<S: Store<E>, E: EthSpec>: PartialEq + Send + Sync + Sized {
|
||||
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>;
|
||||
fn from_bytes(bytes: &[u8], store: Arc<S>, block_root_tree: Arc<BlockRootTree>)
|
||||
-> Result<Self>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user