diff --git a/ethcore/light/src/client/service.rs b/ethcore/light/src/client/service.rs index 3d029b0c1..83949a2f1 100644 --- a/ethcore/light/src/client/service.rs +++ b/ethcore/light/src/client/service.rs @@ -28,7 +28,6 @@ use io::{IoContext, IoError, IoHandler, IoService}; use util::kvdb::{Database, DatabaseConfig}; use cache::Cache; -use time::Duration; use util::Mutex; use super::{Client, Config as ClientConfig}; @@ -59,8 +58,7 @@ pub struct Service { impl Service { /// Start the service: initialize I/O workers and client itself. - pub fn start(config: ClientConfig, spec: &Spec, path: &Path) -> Result { - let cache = Arc::new(Mutex::new(Cache::new(Default::default(), Duration::hours(6)))); + pub fn start(config: ClientConfig, spec: &Spec, path: &Path, cache: Arc>) -> Result { // initialize database. let mut db_config = DatabaseConfig::with_columns(db::NUM_COLUMNS); @@ -119,11 +117,18 @@ mod tests { use super::Service; use devtools::RandomTempPath; use ethcore::spec::Spec; + + use std::sync::Arc; + use cache::Cache; + use time::Duration; + use util::Mutex; #[test] fn it_works() { let spec = Spec::new_test(); let temp_path = RandomTempPath::new(); - Service::start(Default::default(), &spec, temp_path.as_path()).unwrap(); + let cache = Arc::new(Mutex::new(Cache::new(Default::default(), Duration::hours(6)))); + + Service::start(Default::default(), &spec, temp_path.as_path(), cache).unwrap(); } }