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

@@ -15,14 +15,14 @@ use types::{
pub use beacon_chain::{BeaconChainError, BlockProcessingOutcome, InvalidBlock};
/// The network's API to the beacon chain.
pub trait BeaconChain<B: EthSpec>: Send + Sync {
pub trait BeaconChain<E: EthSpec>: Send + Sync {
fn get_spec(&self) -> &ChainSpec;
fn get_state(&self) -> RwLockReadGuard<BeaconState<B>>;
fn get_state(&self) -> RwLockReadGuard<BeaconState<E>>;
fn slot(&self) -> Slot;
fn head(&self) -> RwLockReadGuard<CheckPoint<B>>;
fn head(&self) -> RwLockReadGuard<CheckPoint<E>>;
fn get_block(&self, block_root: &Hash256) -> Result<Option<BeaconBlock>, BeaconChainError>;
@@ -30,7 +30,7 @@ pub trait BeaconChain<B: EthSpec>: Send + Sync {
fn best_block_root(&self) -> Hash256;
fn finalized_head(&self) -> RwLockReadGuard<CheckPoint<B>>;
fn finalized_head(&self) -> RwLockReadGuard<CheckPoint<E>>;
fn finalized_epoch(&self) -> Epoch;
@@ -64,18 +64,18 @@ pub trait BeaconChain<B: EthSpec>: Send + Sync {
fn is_new_block_root(&self, beacon_block_root: &Hash256) -> Result<bool, BeaconChainError>;
}
impl<T, U, F, B> BeaconChain<B> for RawBeaconChain<T, U, F, B>
impl<T, U, F, E> BeaconChain<E> for RawBeaconChain<T, U, F, E>
where
T: ClientDB + Sized,
U: SlotClock,
F: ForkChoice,
B: EthSpec,
E: EthSpec,
{
fn get_spec(&self) -> &ChainSpec {
&self.spec
}
fn get_state(&self) -> RwLockReadGuard<BeaconState<B>> {
fn get_state(&self) -> RwLockReadGuard<BeaconState<E>> {
self.state.read()
}
@@ -83,7 +83,7 @@ where
self.get_state().slot
}
fn head(&self) -> RwLockReadGuard<CheckPoint<B>> {
fn head(&self) -> RwLockReadGuard<CheckPoint<E>> {
self.head()
}
@@ -95,7 +95,7 @@ where
self.get_state().finalized_epoch
}
fn finalized_head(&self) -> RwLockReadGuard<CheckPoint<B>> {
fn finalized_head(&self) -> RwLockReadGuard<CheckPoint<E>> {
self.finalized_head()
}