check for existence of deprecated ethash file before attempting delete (#2103)

This commit is contained in:
Robert Habermeier 2016-09-16 08:57:38 +02:00 committed by Arkadiy Paronyan
parent c16bf7face
commit f8f39c4369

View File

@ -141,9 +141,12 @@ impl Light {
if self.block_number >= ETHASH_EPOCH_LENGTH * 2 {
let deprecated = Light::file_path(
seed_compute.get_seedhash(self.block_number - ETHASH_EPOCH_LENGTH * 2));
if deprecated.exists() {
debug!(target: "ethash", "removing: {:?}", &deprecated);
try!(fs::remove_file(deprecated));
}
}
try!(fs::create_dir_all(path.parent().unwrap()));
let mut file = try!(File::create(&path));