Skip to content

Commit

Permalink
Merge pull request #2720 from subspace/fix-farm-creation
Browse files Browse the repository at this point in the history
Fix farm creation
  • Loading branch information
nazar-pc authored Apr 26, 2024
2 parents e0b3f7d + 5bf047a commit 4c5660d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/subspace-farmer/src/single_disk_farm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}

Expand Down

0 comments on commit 4c5660d

Please sign in to comment.