Update BeaconChain struct to use new store

This commit is contained in:
Paul Hauner
2019-05-21 13:36:14 +10:00
parent 2128d411bc
commit f1584dada4
2 changed files with 12 additions and 24 deletions

View File

@@ -1,8 +1,5 @@
pub use crate::{BeaconChain, BeaconChainError, CheckPoint};
use db::{
stores::{BeaconBlockStore, BeaconStateStore},
MemoryDB,
};
use db::MemoryDB;
use fork_choice::BitwiseLMDGhost;
use slot_clock::TestingSlotClock;
use std::sync::Arc;
@@ -19,11 +16,9 @@ pub struct TestingBeaconChainBuilder<E: EthSpec> {
impl<E: EthSpec> TestingBeaconChainBuilder<E> {
pub fn build(self, spec: &ChainSpec) -> TestingBeaconChain<E> {
let db = Arc::new(MemoryDB::open());
let block_store = Arc::new(BeaconBlockStore::new(db.clone()));
let state_store = Arc::new(BeaconStateStore::new(db.clone()));
let store = Arc::new(MemoryDB::open());
let slot_clock = TestingSlotClock::new(spec.genesis_slot.as_u64());
let fork_choice = BitwiseLMDGhost::new(block_store.clone(), state_store.clone());
let fork_choice = BitwiseLMDGhost::new(store.clone());
let (genesis_state, _keypairs) = self.state_builder.build();
@@ -32,8 +27,7 @@ impl<E: EthSpec> TestingBeaconChainBuilder<E> {
// Create the Beacon Chain
BeaconChain::from_genesis(
state_store.clone(),
block_store.clone(),
store,
slot_clock,
genesis_state,
genesis_block,