Use E for EthSpec trait, instead of B

This commit is contained in:
Paul Hauner
2019-05-13 14:44:43 +10:00
parent afa8fff31a
commit fcabef91da
20 changed files with 110 additions and 110 deletions

View File

@@ -13,7 +13,7 @@ use types::{BeaconBlock, BeaconState, ChainSpec, EthSpec, Hash256, Slot};
//TODO: Pruning and syncing
pub struct SlowLMDGhost<T: ClientDB + Sized, B> {
pub struct SlowLMDGhost<T: ClientDB + Sized, E> {
/// The latest attestation targets as a map of validator index to block hash.
//TODO: Could this be a fixed size vec
latest_attestation_targets: HashMap<u64, Hash256>,
@@ -23,10 +23,10 @@ pub struct SlowLMDGhost<T: ClientDB + Sized, B> {
block_store: Arc<BeaconBlockStore<T>>,
/// State storage access.
state_store: Arc<BeaconStateStore<T>>,
_phantom: PhantomData<B>,
_phantom: PhantomData<E>,
}
impl<T, B: EthSpec> SlowLMDGhost<T, B>
impl<T, E: EthSpec> SlowLMDGhost<T, E>
where
T: ClientDB + Sized,
{
@@ -57,7 +57,7 @@ where
// build a hashmap of block_hash to weighted votes
let mut latest_votes: HashMap<Hash256, u64> = HashMap::new();
// gets the current weighted votes
let current_state: BeaconState<B> = self
let current_state: BeaconState<E> = self
.state_store
.get_deserialized(&state_root)?
.ok_or_else(|| ForkChoiceError::MissingBeaconState(*state_root))?;
@@ -108,7 +108,7 @@ where
}
}
impl<T: ClientDB + Sized, B: EthSpec> ForkChoice for SlowLMDGhost<T, B> {
impl<T: ClientDB + Sized, E: EthSpec> ForkChoice for SlowLMDGhost<T, E> {
/// Process when a block is added
fn add_block(
&mut self,