diff --git a/Cargo.toml b/Cargo.toml index b590208a..e91edb38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,6 +35,7 @@ lto = true # Build with LTO strip = "none" # Keep panic stack traces codegen-units = 1 # Optimize for binary speed over compile times opt-level = 3 +panic = "abort" [profile.dev] lto = false diff --git a/binaries/cuprated/Cargo.toml b/binaries/cuprated/Cargo.toml index f86a5ea8..0428766f 100644 --- a/binaries/cuprated/Cargo.toml +++ b/binaries/cuprated/Cargo.toml @@ -75,9 +75,3 @@ tracing = { workspace = true } [lints] workspace = true - -[profile.dev] -panic = "abort" - -[profile.release] -panic = "abort" diff --git a/binaries/cuprated/src/blockchain/syncer.rs b/binaries/cuprated/src/blockchain/syncer.rs index 7e72c36c..8c023dd8 100644 --- a/binaries/cuprated/src/blockchain/syncer.rs +++ b/binaries/cuprated/src/blockchain/syncer.rs @@ -98,7 +98,11 @@ where tracing::info!("Stopping block downloader"); break; } - Some(batch) = block_batch_stream.next() => { + batch = block_batch_stream.next() => { + let Some(batch) = batch else { + break; + }; + tracing::debug!("Got batch, len: {}", batch.blocks.len()); if incoming_block_batch_tx.send(batch).await.is_err() { return Err(SyncerError::IncomingBlockChannelClosed); diff --git a/binaries/cuprated/src/config.rs b/binaries/cuprated/src/config.rs index 2a55bebb..267f3163 100644 --- a/binaries/cuprated/src/config.rs +++ b/binaries/cuprated/src/config.rs @@ -35,6 +35,7 @@ impl Config { pub fn clearnet_p2p_config(&self) -> cuprate_p2p::P2PConfig { cuprate_p2p::P2PConfig { network: self.network, + seeds: p2p::clear_net_seed_nodes(self.network), outbound_connections: self.p2p.clear_net.general.outbound_connections, extra_outbound_connections: self.p2p.clear_net.general.extra_outbound_connections, max_inbound_connections: self.p2p.clear_net.general.max_inbound_connections, diff --git a/binaries/cuprated/src/config/p2p.rs b/binaries/cuprated/src/config/p2p.rs index f89b2460..85c33d11 100644 --- a/binaries/cuprated/src/config/p2p.rs +++ b/binaries/cuprated/src/config/p2p.rs @@ -1,6 +1,45 @@ use cuprate_address_book::AddressBookConfig; +use cuprate_helper::network::Network; use cuprate_p2p_core::ClearNetServerCfg; use serde::{Deserialize, Serialize}; +use std::net::SocketAddr; + +pub fn clear_net_seed_nodes(network: Network) -> Vec { + let seeds = match network { + Network::Mainnet => [ + "176.9.0.187:18080", + "88.198.163.90:18080", + "66.85.74.134:18080", + "51.79.173.165:18080", + "192.99.8.110:18080", + "37.187.74.171:18080", + "77.172.183.193:18080", + ] + .as_slice(), + Network::Stagenet => [ + "176.9.0.187:38080", + "51.79.173.165:38080", + "192.99.8.110:38080", + "37.187.74.171:38080", + "77.172.183.193:38080", + ] + .as_slice(), + Network::Testnet => [ + "176.9.0.187:28080", + "51.79.173.165:28080", + "192.99.8.110:28080", + "37.187.74.171:28080", + "77.172.183.193:28080", + ] + .as_slice(), + }; + + seeds + .into_iter() + .map(|&s| str::parse(s)) + .collect::>() + .unwrap() +} #[derive(Default, Deserialize, Serialize)] #[serde(deny_unknown_fields, default)] diff --git a/helper/src/network.rs b/helper/src/network.rs index 02574752..8c800760 100644 --- a/helper/src/network.rs +++ b/helper/src/network.rs @@ -22,9 +22,9 @@ const STAGENET_NETWORK_ID: [u8; 16] = [ #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub enum Network { /// Mainnet - #[default] Mainnet, /// Testnet + #[default] Testnet, /// Stagenet Stagenet, diff --git a/p2p/address-book/src/book/tests.rs b/p2p/address-book/src/book/tests.rs index 216fcfac..33f881ee 100644 --- a/p2p/address-book/src/book/tests.rs +++ b/p2p/address-book/src/book/tests.rs @@ -15,7 +15,7 @@ fn test_cfg() -> AddressBookConfig { AddressBookConfig { max_white_list_length: 100, max_gray_list_length: 500, - peer_store_file: PathBuf::new(), + peer_store_folder: PathBuf::new(), peer_save_period: Duration::from_secs(60), } } diff --git a/p2p/p2p-core/src/network_zones/clear.rs b/p2p/p2p-core/src/network_zones/clear.rs index ecc6c0ef..bff7b1ed 100644 --- a/p2p/p2p-core/src/network_zones/clear.rs +++ b/p2p/p2p-core/src/network_zones/clear.rs @@ -1,5 +1,5 @@ use std::{ - net::{IpAddr, SocketAddr}, + net::{IpAddr, Ipv4Addr, SocketAddr}, pin::Pin, task::{Context, Poll}, };