diff --git a/crates/subspace-farmer/src/single_disk_farm.rs b/crates/subspace-farmer/src/single_disk_farm.rs index c56db515fa..d7c0e0d6b3 100644 --- a/crates/subspace-farmer/src/single_disk_farm.rs +++ b/crates/subspace-farmer/src/single_disk_farm.rs @@ -162,9 +162,10 @@ impl SingleDiskFarmInfo { pub fn store_to(&self, directory: &Path) -> io::Result<()> { let mut file = OpenOptions::new() .write(true) + .create(true) + .truncate(true) .open(directory.join(Self::FILE_NAME))?; fs4::FileExt::try_lock_exclusive(&file)?; - file.set_len(0)?; file.write_all(&serde_json::to_vec(self).expect("Info serialization never fails; qed")) }