Recover incoming settlement and persist immutable purchase journals

This commit is contained in:
archipelago
2026-10-06 19:22:10 -04:00
parent 1c6daab92a
commit cae0099d6f
7 changed files with 2262 additions and 14 deletions
+4 -2
View File
@@ -979,14 +979,16 @@ impl<'a> Journal<'a> {
file.write_all(&bytes).await?;
file.sync_all().await?;
drop(file);
fs::rename(&temporary.0, &path).await?;
// Keep the commit synchronous under the mutation guard: cancellation
// cannot leave a rename queued after a newer wallet mutation starts.
std::fs::rename(&temporary.0, &path)?;
// Persist every new directory entry down from the existing node root.
for directory in [
parent.to_path_buf(),
self.guard.data_dir.join("wallet"),
self.guard.data_dir.clone(),
] {
fs::File::open(directory).await?.sync_all().await?;
std::fs::File::open(directory)?.sync_all()?;
}
Ok(())
}