X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fdisk.rs;h=8a54592201d65610965ded747216fc961505329a;hb=8decf4bb58ab615f06e2a7e3cac6e4ef32634a62;hp=af565bc5b8afac37e05c43bb2e6f2ce855800f47;hpb=a390ef2a3844f5b8ce03c35169b5c15ee2a1aaa6;p=ldk-sample diff --git a/src/disk.rs b/src/disk.rs index af565bc..8a54592 100644 --- a/src/disk.rs +++ b/src/disk.rs @@ -73,19 +73,6 @@ pub(crate) fn read_channel_peer_data( Ok(peer_data) } -pub(crate) fn persist_network(path: &Path, network_graph: &NetworkGraph) -> std::io::Result<()> { - let mut tmp_path = path.to_path_buf().into_os_string(); - tmp_path.push(".tmp"); - let file = fs::OpenOptions::new().write(true).create(true).open(&tmp_path)?; - let write_res = network_graph.write(&mut BufWriter::new(file)); - if let Err(e) = write_res.and_then(|_| fs::rename(&tmp_path, path)) { - let _ = fs::remove_file(&tmp_path); - Err(e) - } else { - Ok(()) - } -} - pub(crate) fn read_network(path: &Path, genesis_hash: BlockHash) -> NetworkGraph { if let Ok(file) = File::open(path) { if let Ok(graph) = NetworkGraph::read(&mut BufReader::new(file)) {