From cde049df1f16bc5cd39fb1de499b904410577043 Mon Sep 17 00:00:00 2001 From: Age Manning Date: Wed, 27 Mar 2019 19:52:05 +1100 Subject: [PATCH] Adds RwLock to EpochDuty --- validator_client/src/service.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/validator_client/src/service.rs b/validator_client/src/service.rs index c8e03e73d..f47570f74 100644 --- a/validator_client/src/service.rs +++ b/validator_client/src/service.rs @@ -19,6 +19,7 @@ use protos::services_grpc::{ use slog::{debug, error, info, warn}; use slot_clock::{SlotClock, SystemTimeSlotClock}; use std::sync::Arc; +use std::sync::RwLock; use std::time::{Duration, Instant, SystemTime}; use tokio::prelude::*; use tokio::runtime::Builder; @@ -224,7 +225,7 @@ impl Service { // Builds a mapping of Epoch -> Map(PublicKey, EpochDuty) // where EpochDuty contains slot numbers and attestation data that each validator needs to // produce work on. - let duties_map = EpochDutiesMap::new(config.spec.slots_per_epoch); + let duties_map = RwLock::new(EpochDutiesMap::new(config.spec.slots_per_epoch)); // builds a manager which maintains the list of current duties for all known validators // and can check when a validator needs to perform a task.