check for existence of deprecated ethash file before attempting delete (#2103)
This commit is contained in:
parent
c16bf7face
commit
f8f39c4369
@ -141,9 +141,12 @@ impl Light {
|
|||||||
if self.block_number >= ETHASH_EPOCH_LENGTH * 2 {
|
if self.block_number >= ETHASH_EPOCH_LENGTH * 2 {
|
||||||
let deprecated = Light::file_path(
|
let deprecated = Light::file_path(
|
||||||
seed_compute.get_seedhash(self.block_number - ETHASH_EPOCH_LENGTH * 2));
|
seed_compute.get_seedhash(self.block_number - ETHASH_EPOCH_LENGTH * 2));
|
||||||
|
|
||||||
|
if deprecated.exists() {
|
||||||
debug!(target: "ethash", "removing: {:?}", &deprecated);
|
debug!(target: "ethash", "removing: {:?}", &deprecated);
|
||||||
try!(fs::remove_file(deprecated));
|
try!(fs::remove_file(deprecated));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try!(fs::create_dir_all(path.parent().unwrap()));
|
try!(fs::create_dir_all(path.parent().unwrap()));
|
||||||
let mut file = try!(File::create(&path));
|
let mut file = try!(File::create(&path));
|
||||||
|
Loading…
Reference in New Issue
Block a user