mirror of
https://github.com/Cuprate/cuprate.git
synced 2025-01-21 02:04:33 +00:00
misc changes
This commit is contained in:
parent
3dc0049481
commit
d1f3eb40bf
8 changed files with 32 additions and 12 deletions
|
@ -32,6 +32,7 @@ members = [
|
|||
]
|
||||
|
||||
[profile.release]
|
||||
panic = "abort"
|
||||
lto = true # Build with LTO
|
||||
strip = "none" # Keep panic stack traces
|
||||
codegen-units = 1 # Optimize for binary speed over compile times
|
||||
|
@ -115,6 +116,7 @@ tokio-util = { version = "0.7.12", default-features = false }
|
|||
tokio-stream = { version = "0.1.16", default-features = false }
|
||||
tokio = { version = "1.40.0", default-features = false }
|
||||
tower = { git = "https://github.com/Cuprate/tower.git", rev = "6c7faf0", default-features = false } # <https://github.com/tower-rs/tower/pull/796>
|
||||
toml = { version = "0.8", default-features = false }
|
||||
tracing-subscriber = { version = "0.3.18", default-features = false }
|
||||
tracing = { version = "0.1.40", default-features = false }
|
||||
|
||||
|
|
|
@ -70,10 +70,10 @@ thread_local = { workspace = true }
|
|||
tokio-util = { workspace = true }
|
||||
tokio-stream = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
toml = { workspace = true, features = ["parse"]}
|
||||
tower = { workspace = true }
|
||||
tracing-subscriber = { workspace = true, features = ["std", "fmt", "default"] }
|
||||
tracing = { workspace = true, features = ["default"] }
|
||||
toml = "0.8"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -113,7 +113,7 @@ impl Config {
|
|||
p2p_port: self.p2p.clear_net.general.p2p_port,
|
||||
// TODO: set this if a public RPC server is set.
|
||||
rpc_port: 0,
|
||||
address_book_config: self.p2p.clear_net.general.address_book_config.clone(),
|
||||
address_book_config: self.p2p.clear_net.general.address_book_config(self.network),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,20 @@ pub struct SharedNetConfig {
|
|||
/// port to use to accept p2p connections.
|
||||
pub p2p_port: u16,
|
||||
/// The address book config.
|
||||
pub address_book_config: AddressBookConfig,
|
||||
address_book_config: AddressBookConfig,
|
||||
}
|
||||
|
||||
impl SharedNetConfig {
|
||||
/// Returns the [`AddressBookConfig`].
|
||||
pub fn address_book_config(&self, network: Network) -> AddressBookConfig {
|
||||
// HACK: we add the network here so we don't need to define another address book config.
|
||||
let mut address_book_config = self.address_book_config.clone();
|
||||
address_book_config
|
||||
.peer_store_folder
|
||||
.push(network.to_string());
|
||||
|
||||
address_book_config
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for SharedNetConfig {
|
||||
|
|
|
@ -28,9 +28,12 @@
|
|||
//! - <https://docs.rs/dirs>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- Use
|
||||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
sync::LazyLock,
|
||||
};
|
||||
|
||||
use crate::network::Network;
|
||||
use std::path::Path;
|
||||
use std::{path::PathBuf, sync::LazyLock};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- Const
|
||||
/// Cuprate's main directory.
|
||||
|
@ -180,6 +183,7 @@ impl_path_lazylock! {
|
|||
"txpool",
|
||||
}
|
||||
|
||||
/// Joins the [`Path`] with a folder for the given [`Network`].
|
||||
pub fn path_with_network(path: &Path, network: Network) -> PathBuf {
|
||||
path.join(network.to_string())
|
||||
}
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
//!
|
||||
//! `#[no_std]` compatible.
|
||||
// TODO: move to types crate.
|
||||
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::str::FromStr;
|
||||
use std::{
|
||||
fmt::{Display, Formatter},
|
||||
str::FromStr,
|
||||
};
|
||||
|
||||
const MAINNET_NETWORK_ID: [u8; 16] = [
|
||||
0x12, 0x30, 0xF1, 0x71, 0x61, 0x04, 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x16, 0xA1, 0xA1, 0x10,
|
||||
|
|
|
@ -51,8 +51,6 @@ impl<'a> From<&'a PeerSupportFlags> for &'a u32 {
|
|||
}
|
||||
}
|
||||
|
||||
//15515542498767257178
|
||||
|
||||
/// Basic Node Data, information on the connected peer
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct BasicNodeData {
|
||||
|
|
|
@ -47,11 +47,13 @@ use std::{borrow::Cow, path::PathBuf};
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use cuprate_database::{config::SyncMode, resize::ResizeAlgorithm};
|
||||
use cuprate_helper::fs::{path_with_network, CUPRATE_BLOCKCHAIN_DIR};
|
||||
use cuprate_helper::{
|
||||
fs::{path_with_network, CUPRATE_BLOCKCHAIN_DIR},
|
||||
network::Network,
|
||||
};
|
||||
|
||||
// re-exports
|
||||
pub use cuprate_database_service::ReaderThreads;
|
||||
use cuprate_helper::network::Network;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- ConfigBuilder
|
||||
/// Builder for [`Config`].
|
||||
|
|
Loading…
Reference in a new issue