Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1356 from ethcore/clean_parity_start
Browse files Browse the repository at this point in the history
removed unnecessary logs
  • Loading branch information
tomusdrw authored Jun 20, 2016
2 parents 69c29fc + 7b9db37 commit beedbd5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 2 additions & 3 deletions parity/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,8 @@ impl Configuration {

let from = GethDirectory::open(dir_type);
let to = DiskDirectory::create(self.keys_path()).unwrap();
if let Err(e) = import_accounts(&from, &to) {
warn!("Could not import accounts {}", e);
}
// ignore error, cause geth may not exist
let _ = import_accounts(&from, &to);
}

let dir = Box::new(DiskDirectory::create(self.keys_path()).unwrap());
Expand Down
12 changes: 8 additions & 4 deletions parity/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ fn migrate_database(version: u32, path: PathBuf, migrations: MigrationManager) -
return Ok(())
}

println!("Migrating database {} from version {} to {}", path.to_string_lossy(), version, CURRENT_VERSION);

let temp_path = temp_database_path(&path);
let backup_path = backup_database_path(&path);
// remote the dir if it exists
Expand Down Expand Up @@ -188,20 +186,26 @@ fn migrate_database(version: u32, path: PathBuf, migrations: MigrationManager) -

// remove backup
try!(fs::remove_dir_all(&backup_path));
println!("Migration finished");

Ok(())
}

fn exists(path: &PathBuf) -> bool {
fs::metadata(path).is_ok()
}

/// Migrates the database.
pub fn migrate(path: &PathBuf) -> Result<(), Error> {
// read version file.
let version = try!(current_version(path));

// migrate the databases.
if version != CURRENT_VERSION {
// main db directory may already exists, so let's check if we have blocks dir
if version != CURRENT_VERSION && exists(&blocks_database_path(path)) {
println!("Migrating database from version {} to {}", version, CURRENT_VERSION);
try!(migrate_database(version, blocks_database_path(path), try!(blocks_database_migrations())));
try!(migrate_database(version, extras_database_path(path), try!(extras_database_migrations())));
println!("Migration finished");
}

// update version file.
Expand Down

0 comments on commit beedbd5

Please sign in to comment.