From 529dfce4132475d4d0ad7b9f34f6b3199af608a7 Mon Sep 17 00:00:00 2001 From: Daniil Polyakov Date: Thu, 26 Feb 2026 15:12:36 +0300 Subject: [PATCH] fix: ensure wallet data is fully synced with fs --- wallet/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wallet/src/lib.rs b/wallet/src/lib.rs index cb364fd3..0162dcb1 100644 --- a/wallet/src/lib.rs +++ b/wallet/src/lib.rs @@ -156,6 +156,8 @@ impl WalletCore { let mut storage_file = tokio::fs::File::create(&self.storage_path).await?; storage_file.write_all(&storage).await?; + // Ensure data is flushed to disk before returning to prevent race conditions + storage_file.sync_all().await?; println!("Stored persistent accounts at {:#?}", self.storage_path); @@ -168,6 +170,8 @@ impl WalletCore { let mut config_file = tokio::fs::File::create(&self.config_path).await?; config_file.write_all(&config).await?; + // Ensure data is flushed to disk before returning to prevent race conditions + config_file.sync_all().await?; info!("Stored data at {:#?}", self.config_path);