Merge pull request #1356 from ethcore/clean_parity_start

removed unnecessary logs
This commit is contained in:
Tomasz Drwięga 2016-06-20 21:15:32 +02:00 committed by GitHub
commit beedbd5126
2 changed files with 10 additions and 7 deletions

View File

@ -299,9 +299,8 @@ impl Configuration {
let from = GethDirectory::open(dir_type); let from = GethDirectory::open(dir_type);
let to = DiskDirectory::create(self.keys_path()).unwrap(); let to = DiskDirectory::create(self.keys_path()).unwrap();
if let Err(e) = import_accounts(&from, &to) { // ignore error, cause geth may not exist
warn!("Could not import accounts {}", e); let _ = import_accounts(&from, &to);
}
} }
let dir = Box::new(DiskDirectory::create(self.keys_path()).unwrap()); let dir = Box::new(DiskDirectory::create(self.keys_path()).unwrap());

View File

@ -151,8 +151,6 @@ fn migrate_database(version: u32, path: PathBuf, migrations: MigrationManager) -
return Ok(()) return Ok(())
} }
println!("Migrating database {} from version {} to {}", path.to_string_lossy(), version, CURRENT_VERSION);
let temp_path = temp_database_path(&path); let temp_path = temp_database_path(&path);
let backup_path = backup_database_path(&path); let backup_path = backup_database_path(&path);
// remote the dir if it exists // remote the dir if it exists
@ -188,20 +186,26 @@ fn migrate_database(version: u32, path: PathBuf, migrations: MigrationManager) -
// remove backup // remove backup
try!(fs::remove_dir_all(&backup_path)); try!(fs::remove_dir_all(&backup_path));
println!("Migration finished");
Ok(()) Ok(())
} }
fn exists(path: &PathBuf) -> bool {
fs::metadata(path).is_ok()
}
/// Migrates the database. /// Migrates the database.
pub fn migrate(path: &PathBuf) -> Result<(), Error> { pub fn migrate(path: &PathBuf) -> Result<(), Error> {
// read version file. // read version file.
let version = try!(current_version(path)); let version = try!(current_version(path));
// migrate the databases. // 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, blocks_database_path(path), try!(blocks_database_migrations())));
try!(migrate_database(version, extras_database_path(path), try!(extras_database_migrations()))); try!(migrate_database(version, extras_database_path(path), try!(extras_database_migrations())));
println!("Migration finished");
} }
// update version file. // update version file.