Fix memory blow-up with Arc<ChainSpec>
Previously it was cloning the ChainSpec, now it shares an Arc.
This commit is contained in:
parent
02a962d35d
commit
becb81d842
@ -19,7 +19,7 @@ pub struct BeaconChainHarness {
|
||||
pub block_store: Arc<BeaconBlockStore<MemoryDB>>,
|
||||
pub state_store: Arc<BeaconStateStore<MemoryDB>>,
|
||||
pub validators: Vec<TestValidator>,
|
||||
pub spec: ChainSpec,
|
||||
pub spec: Arc<ChainSpec>,
|
||||
}
|
||||
|
||||
impl BeaconChainHarness {
|
||||
@ -74,12 +74,14 @@ impl BeaconChainHarness {
|
||||
.unwrap(),
|
||||
);
|
||||
|
||||
let spec = Arc::new(spec);
|
||||
|
||||
debug!("Creating validator producer and attester instances...");
|
||||
|
||||
// Spawn the test validator instances.
|
||||
let validators: Vec<TestValidator> = keypairs
|
||||
.par_iter()
|
||||
.map(|keypair| TestValidator::new(keypair.clone(), beacon_chain.clone(), &spec))
|
||||
.iter()
|
||||
.map(|keypair| TestValidator::new(keypair.clone(), beacon_chain.clone(), spec.clone()))
|
||||
.collect();
|
||||
|
||||
debug!("Created {} TestValidators", validators.len());
|
||||
|
@ -52,9 +52,8 @@ impl TestValidator {
|
||||
pub fn new(
|
||||
keypair: Keypair,
|
||||
beacon_chain: Arc<BeaconChain<MemoryDB, TestingSlotClock>>,
|
||||
spec: &ChainSpec,
|
||||
spec: Arc<ChainSpec>,
|
||||
) -> Self {
|
||||
let spec = Arc::new(spec.clone());
|
||||
let slot_clock = Arc::new(TestingSlotClock::new(spec.genesis_slot));
|
||||
let signer = Arc::new(TestSigner::new(keypair.clone()));
|
||||
let beacon_node = Arc::new(BenchingBeaconNode::new(beacon_chain.clone()));
|
||||
|
Loading…
Reference in New Issue
Block a user