mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 22:08:30 +00:00
Add stubbed-out block processing to fork choice
This commit is contained in:
@@ -9,18 +9,27 @@ pub use reduced_tree::ThreadSafeReducedTree;
|
||||
pub type Result<T> = std::result::Result<T, String>;
|
||||
|
||||
pub trait LmdGhost<S: Store, E: EthSpec>: Send + Sync {
|
||||
fn new(store: Arc<S>, genesis_root: Hash256) -> Self;
|
||||
/// Create a new instance, with the given `store` and `finalized_root`.
|
||||
fn new(store: Arc<S>, finalized_root: Hash256) -> Self;
|
||||
|
||||
fn process_message(
|
||||
/// Process an attestation message from some validator that attests to some `block_hash`
|
||||
/// representing a block at some `block_slot`.
|
||||
fn process_attestation(
|
||||
&self,
|
||||
validator_index: usize,
|
||||
block_hash: Hash256,
|
||||
block_slot: Slot,
|
||||
) -> Result<()>;
|
||||
|
||||
/// Process a block that was seen on the network.
|
||||
fn process_block(&self, block_hash: Hash256, block_slot: Slot) -> Result<()>;
|
||||
|
||||
/// Returns the head of the chain, starting the search at `start_block_root` and moving upwards
|
||||
/// (in block height).
|
||||
fn find_head<F>(&self, start_block_root: Hash256, weight: F) -> Result<Hash256>
|
||||
where
|
||||
F: Fn(usize) -> Option<u64> + Copy;
|
||||
|
||||
fn update_finalized_root(&self, new_root: Hash256) -> Result<()>;
|
||||
/// Provide an indication that the blockchain has been finalized at the given `finalized_root`.
|
||||
fn update_finalized_root(&self, finalized_root: Hash256) -> Result<()>;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn process_message(
|
||||
fn process_attestation(
|
||||
&self,
|
||||
validator_index: usize,
|
||||
block_hash: Hash256,
|
||||
@@ -52,6 +52,11 @@ where
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
/// Process a block that was seen on the network.
|
||||
fn process_block(&self, block_hash: Hash256, block_slot: Slot) -> SuperResult<()> {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
fn find_head<F>(&self, start_block_root: Hash256, weight_fn: F) -> SuperResult<Hash256>
|
||||
where
|
||||
F: Fn(usize) -> Option<u64> + Copy,
|
||||
|
||||
Reference in New Issue
Block a user