From 864380b15cad84a0fd742c0d943470634c87f456 Mon Sep 17 00:00:00 2001 From: Boog900 <54e72d8a-345f-4599-bd90-c6b9bc7d0ec5@aleeas.com> Date: Wed, 18 Dec 2024 23:14:40 +0000 Subject: [PATCH] fix address book saves --- p2p/address-book/src/store.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/p2p/address-book/src/store.rs b/p2p/address-book/src/store.rs index 47994ae5..e1da2b4a 100644 --- a/p2p/address-book/src/store.rs +++ b/p2p/address-book/src/store.rs @@ -39,10 +39,15 @@ pub(crate) fn save_peers_to_disk( }) .unwrap(); - let file = cfg - .peer_store_directory + let dir = cfg + .peer_store_directory.clone(); + let file = dir .join(format!("{}_p2p_state", Z::NAME)); - spawn_blocking(move || fs::write(&file, &data)) + + spawn_blocking(move || { + fs::create_dir_all(dir)?; + fs::write(&file, &data) } + ) } pub(crate) async fn read_peers_from_disk(