diff --git a/consensus/src/rpc/cache.rs b/consensus/src/rpc/cache.rs index f50aa4d6..2856f6c6 100644 --- a/consensus/src/rpc/cache.rs +++ b/consensus/src/rpc/cache.rs @@ -1,7 +1,9 @@ +use std::io::Write; use std::{ collections::HashMap, collections::HashSet, fmt::{Display, Formatter}, + io::BufWriter, path::Path, sync::Arc, }; @@ -35,8 +37,9 @@ impl ScanningCache { .truncate(true) .create(true) .open(file)?; - let mut writer = file.make_writer(); + let mut writer = BufWriter::new(file.make_writer()); bincode::encode_into_std_write(self, &mut writer, bincode::config::standard())?; + writer.flush()?; Ok(()) } diff --git a/consensus/src/rpc/discover.rs b/consensus/src/rpc/discover.rs index 4841bc0e..5dbda69b 100644 --- a/consensus/src/rpc/discover.rs +++ b/consensus/src/rpc/discover.rs @@ -7,7 +7,7 @@ use std::{ use futures::{ channel::mpsc::{self, SendError}, stream::FuturesUnordered, - SinkExt, + SinkExt, StreamExt, }; use monero_serai::rpc::HttpRpc; use tokio::time::timeout;