From 08fea24649314c8e60442ed5d99cf164506bdf77 Mon Sep 17 00:00:00 2001 From: Thoralf-M <46689931+Thoralf-M@users.noreply.github.com> Date: Fri, 6 Oct 2023 21:45:42 +0200 Subject: [PATCH] Fix offline signing examples (#1404) --- sdk/examples/client/offline_signing/0_address_generation.rs | 1 + sdk/examples/client/offline_signing/1_transaction_preparation.rs | 1 + sdk/examples/client/offline_signing/2_transaction_signing.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/sdk/examples/client/offline_signing/0_address_generation.rs b/sdk/examples/client/offline_signing/0_address_generation.rs index a34e827889..1262e95a12 100644 --- a/sdk/examples/client/offline_signing/0_address_generation.rs +++ b/sdk/examples/client/offline_signing/0_address_generation.rs @@ -46,6 +46,7 @@ async fn write_address_to_file(path: impl AsRef, address: &[Bec println!("{json}"); file.write_all(json.as_bytes()).await.expect("failed to write to file"); + file.flush().await.expect("failed to flush output stream"); Ok(()) } diff --git a/sdk/examples/client/offline_signing/1_transaction_preparation.rs b/sdk/examples/client/offline_signing/1_transaction_preparation.rs index e4f7467eb0..81b9cedf55 100644 --- a/sdk/examples/client/offline_signing/1_transaction_preparation.rs +++ b/sdk/examples/client/offline_signing/1_transaction_preparation.rs @@ -89,6 +89,7 @@ async fn write_prepared_transaction_to_file( println!("{json}"); file.write_all(json.as_bytes()).await.expect("failed to write file"); + file.flush().await.expect("failed to flush output stream"); Ok(()) } diff --git a/sdk/examples/client/offline_signing/2_transaction_signing.rs b/sdk/examples/client/offline_signing/2_transaction_signing.rs index 5222c52542..74519986dd 100644 --- a/sdk/examples/client/offline_signing/2_transaction_signing.rs +++ b/sdk/examples/client/offline_signing/2_transaction_signing.rs @@ -72,6 +72,7 @@ async fn write_signed_transaction_to_file( let mut file = tokio::io::BufWriter::new(tokio::fs::File::create(path).await.expect("failed to create file")); println!("{json}"); file.write_all(json.as_bytes()).await.expect("failed to write file"); + file.flush().await.expect("failed to flush output stream"); Ok(()) }