fix address book saves
Some checks failed
Deny / audit (push) Has been cancelled

This commit is contained in:
Boog900 2024-12-18 23:14:40 +00:00
parent e3a2877882
commit 864380b15c
No known key found for this signature in database
GPG key ID: 42AB1287CB0041C2

View file

@ -39,10 +39,15 @@ pub(crate) fn save_peers_to_disk<Z: BorshNetworkZone>(
}) })
.unwrap(); .unwrap();
let file = cfg let dir = cfg
.peer_store_directory .peer_store_directory.clone();
let file = dir
.join(format!("{}_p2p_state", Z::NAME)); .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<Z: BorshNetworkZone>( pub(crate) async fn read_peers_from_disk<Z: BorshNetworkZone>(