From b0f6bf2e786eef532b7498b51d44475808e5cdec Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Wed, 7 Sep 2016 19:38:59 +0200 Subject: [PATCH] remove client_db field from snapshot service --- ethcore/src/client/client.rs | 2 ++ ethcore/src/service.rs | 1 - ethcore/src/snapshot/service.rs | 7 ------- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index e1d603082..b6333902b 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -673,6 +673,8 @@ impl Client { impl snapshot::DatabaseRestore for Client { /// Restart the client with a new backend fn restore_db(&self, new_db: &str) -> Result<(), EthcoreError> { + trace!(target: "snapshot", "Replacing client database with {:?}", new_db); + let _import_lock = self.import_lock.lock(); let mut state_db = self.state_db.write(); let mut chain = self.chain.write(); diff --git a/ethcore/src/service.rs b/ethcore/src/service.rs index a2b483d40..aee039996 100644 --- a/ethcore/src/service.rs +++ b/ethcore/src/service.rs @@ -94,7 +94,6 @@ impl ClientService { pruning: pruning, channel: io_service.channel(), snapshot_root: snapshot_path.into(), - client_db: client_path.into(), db_restore: client.clone(), }; let snapshot = Arc::new(try!(SnapshotService::new(snapshot_params))); diff --git a/ethcore/src/snapshot/service.rs b/ethcore/src/snapshot/service.rs index 2a186378f..c5d82ace0 100644 --- a/ethcore/src/snapshot/service.rs +++ b/ethcore/src/snapshot/service.rs @@ -187,9 +187,6 @@ pub struct ServiceParams { /// The directory to put snapshots in. /// Usually "/snapshot" pub snapshot_root: PathBuf, - /// The client's database directory. - /// Usually "//db". - pub client_db: PathBuf, /// A handle for database restoration. pub db_restore: Arc, } @@ -198,7 +195,6 @@ pub struct ServiceParams { /// This controls taking snapshots and restoring from them. pub struct Service { restoration: Mutex>, - client_db: PathBuf, snapshot_root: PathBuf, db_config: DatabaseConfig, io_channel: Channel, @@ -219,7 +215,6 @@ impl Service { pub fn new(params: ServiceParams) -> Result { let mut service = Service { restoration: Mutex::new(None), - client_db: params.client_db, snapshot_root: params.snapshot_root, db_config: params.db_config, io_channel: params.channel, @@ -301,7 +296,6 @@ impl Service { fn replace_client_db(&self) -> Result<(), Error> { let our_db = self.restoration_db(); - trace!(target: "snapshot", "replacing {:?} with {:?}", self.client_db, our_db); try!(self.db_restore.restore_db(our_db.to_str().unwrap())); Ok(()) } @@ -585,7 +579,6 @@ mod tests { pruning: Algorithm::Archive, channel: service.channel(), snapshot_root: dir, - client_db: client_db, db_restore: Arc::new(NoopDBRestore), };