mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 04:48:21 +00:00
Integrate ForkChoice into beacon_node.
This commit is contained in:
@@ -30,7 +30,7 @@ use types::{BeaconBlock, Hash256};
|
||||
/// Defines the interface for Fork Choices. Each Fork choice will define their own data structures
|
||||
/// which can be built in block processing through the `add_block` and `add_attestation` functions.
|
||||
/// The main fork choice algorithm is specified in `find_head
|
||||
pub trait ForkChoice {
|
||||
pub trait ForkChoice: Send + Sync {
|
||||
/// Called when a block has been added. Allows generic block-level data structures to be
|
||||
/// built for a given fork-choice.
|
||||
fn add_block(
|
||||
|
||||
@@ -62,15 +62,18 @@ impl<T> OptimisedLMDGhost<T>
|
||||
where
|
||||
T: ClientDB + Sized,
|
||||
{
|
||||
pub fn new(block_store: BeaconBlockStore<T>, state_store: BeaconStateStore<T>) -> Self {
|
||||
pub fn new(
|
||||
block_store: Arc<BeaconBlockStore<T>>,
|
||||
state_store: Arc<BeaconStateStore<T>>,
|
||||
) -> Self {
|
||||
OptimisedLMDGhost {
|
||||
cache: HashMap::new(),
|
||||
ancestors: vec![HashMap::new(); 16],
|
||||
latest_attestation_targets: HashMap::new(),
|
||||
children: HashMap::new(),
|
||||
max_known_height: 0,
|
||||
block_store: Arc::new(block_store),
|
||||
state_store: Arc::new(state_store),
|
||||
block_store,
|
||||
state_store,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user