Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
stringhandler committed Dec 13, 2024
1 parent 2529059 commit 3e4b465
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
2 changes: 0 additions & 2 deletions src/server/p2p/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ pub(crate) struct Config {
pub is_seed_peer: bool,
pub debug_print_chain: bool,
pub sync_job_enabled: bool,
pub peer_list_folder: PathBuf,
pub sha3x_enabled: bool,
pub randomx_enabled: bool,
pub num_concurrent_syncs: usize,
Expand All @@ -182,7 +181,6 @@ impl Default for Config {
seed_peers: vec![],
peer_info_publish_interval: Duration::from_secs(60 * 15),
stable_peer: true,
peer_list_folder: PathBuf::from("."),
private_key_folder: PathBuf::from("."),
private_key: None,
mdns_enabled: false,
Expand Down
23 changes: 1 addition & 22 deletions src/server/p2p/peer_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@

use std::{
collections::{HashMap, HashSet},
fs::File,
io::{BufReader, Write},
path::Path,
str::FromStr,
time::Instant,
};

use anyhow::Error;
use libp2p::PeerId;
use log::warn;
use tari_core::proof_of_work::PowAlgorithm;
use tari_utilities::epoch_time::EpochTime;

use crate::server::{http::stats_collector::StatsBroadcastClient, p2p::messages::PeerInfo, PROTOCOL_VERSION};
use crate::server::{http::stats_collector::StatsBroadcastClient, p2p::messages::PeerInfo};

const LOG_TARGET: &str = "tari::p2pool::peer_store";
// const PEER_BAN_TIME: Duration = Duration::from_secs(60 * 5);
Expand Down Expand Up @@ -51,11 +47,6 @@ impl PeerStoreRecord {
}
}

pub fn with_timestamp(mut self, timestamp: u64) -> Self {
self.peer_info.timestamp = timestamp;
self
}

pub fn last_seen(&self) -> EpochTime {
self.last_ping
.unwrap_or_else(|| EpochTime::from(self.peer_info.timestamp))
Expand Down Expand Up @@ -315,18 +306,6 @@ impl PeerStore {
AddPeerStatus::NewPeer
}

pub async fn save_whitelist(&self, path: &Path) -> Result<(), Error> {
let mut file = File::create(path)?;
let whitelist = self
.whitelist_peers
.iter()
.map(|(peer_id, record)| (peer_id.clone(), record.peer_info.clone()))
.collect::<HashMap<String, PeerInfo>>();
let json = serde_json::to_string(&whitelist)?;
file.write_all(json.as_bytes())?;
Ok(())
}

pub fn clear_grey_list(&mut self) {
for (peer_id, record) in self.greylist_peers.drain() {
if record.num_grey_listings >= MAX_GREY_LISTINGS {
Expand Down

0 comments on commit 3e4b465

Please sign in to comment.