fix syncer + add seed nodes
Some checks failed
Audit / audit (push) Has been cancelled
Deny / audit (push) Has been cancelled

This commit is contained in:
Boog900 2024-10-07 19:58:11 +01:00
parent c0e437565c
commit 659958318c
No known key found for this signature in database
GPG key ID: 42AB1287CB0041C2
8 changed files with 49 additions and 10 deletions

View file

@ -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

View file

@ -75,9 +75,3 @@ tracing = { workspace = true }
[lints]
workspace = true
[profile.dev]
panic = "abort"
[profile.release]
panic = "abort"

View file

@ -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);

View file

@ -35,6 +35,7 @@ impl Config {
pub fn clearnet_p2p_config(&self) -> cuprate_p2p::P2PConfig<ClearNet> {
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,

View file

@ -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<SocketAddr> {
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::<Result<_, _>>()
.unwrap()
}
#[derive(Default, Deserialize, Serialize)]
#[serde(deny_unknown_fields, default)]

View file

@ -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,

View file

@ -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),
}
}

View file

@ -1,5 +1,5 @@
use std::{
net::{IpAddr, SocketAddr},
net::{IpAddr, Ipv4Addr, SocketAddr},
pin::Pin,
task::{Context, Poll},
};