mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2025-01-04 10:14:27 +00:00
Add topics to chain id
This commit is contained in:
parent
95ce8ca6e6
commit
e9181e120c
@ -18,6 +18,21 @@ pub struct ClientConfig {
|
|||||||
|
|
||||||
impl Default for ClientConfig {
|
impl Default for ClientConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
|
let data_dir = {
|
||||||
|
let home = dirs::home_dir().expect("Unable to determine home dir.");
|
||||||
|
home.join(".lighthouse/")
|
||||||
|
};
|
||||||
|
fs::create_dir_all(&data_dir)
|
||||||
|
.unwrap_or_else(|_| panic!("Unable to create {:?}", &data_dir));
|
||||||
|
|
||||||
|
let default_spec = ChainSpec::lighthouse_testnet();
|
||||||
|
let default_pubsub_topics = vec![
|
||||||
|
default_spec.beacon_chain_topic.clone(),
|
||||||
|
default_spec.shard_topic_prefix.clone(),
|
||||||
|
]; // simple singular attestation topic for now.
|
||||||
|
let default_net_conf =
|
||||||
|
NetworkConfig::new(default_spec.boot_nodes.clone(), default_pubsub_topics);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
data_dir: PathBuf::from(".lighthouse"),
|
data_dir: PathBuf::from(".lighthouse"),
|
||||||
db_type: "disk".to_string(),
|
db_type: "disk".to_string(),
|
||||||
|
@ -2,6 +2,7 @@ use clap::ArgMatches;
|
|||||||
use libp2p::gossipsub::{GossipsubConfig, GossipsubConfigBuilder};
|
use libp2p::gossipsub::{GossipsubConfig, GossipsubConfigBuilder};
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use types::multiaddr::{Error as MultiaddrError, Multiaddr};
|
use types::multiaddr::{Error as MultiaddrError, Multiaddr};
|
||||||
|
//use std::time::Duration;
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
@ -30,19 +31,21 @@ impl Default for Config {
|
|||||||
listen_addresses: vec!["/ip4/127.0.0.1/tcp/9000".to_string()],
|
listen_addresses: vec!["/ip4/127.0.0.1/tcp/9000".to_string()],
|
||||||
gs_config: GossipsubConfigBuilder::new()
|
gs_config: GossipsubConfigBuilder::new()
|
||||||
.max_gossip_size(4_000_000)
|
.max_gossip_size(4_000_000)
|
||||||
|
// .inactivity_timeout(Duration::from_secs(90))
|
||||||
.build(),
|
.build(),
|
||||||
identify_config: IdentifyConfig::default(),
|
identify_config: IdentifyConfig::default(),
|
||||||
boot_nodes: vec![],
|
boot_nodes: vec![],
|
||||||
client_version: version::version(),
|
client_version: version::version(),
|
||||||
topics: vec![String::from("beacon_chain")],
|
topics: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn new(boot_nodes: Vec<String>) -> Self {
|
pub fn new(boot_nodes: Vec<Multiaddr>, topics: Vec<String>) -> Self {
|
||||||
let mut conf = Config::default();
|
let mut conf = Config::default();
|
||||||
conf.boot_nodes = boot_nodes;
|
conf.boot_nodes = boot_nodes;
|
||||||
|
conf.topics = topics;
|
||||||
|
|
||||||
conf
|
conf
|
||||||
}
|
}
|
||||||
|
@ -106,10 +106,11 @@ pub struct ChainSpec {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Network specific parameters
|
* Network specific parameters
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
pub boot_nodes: Vec<Multiaddr>,
|
pub boot_nodes: Vec<Multiaddr>,
|
||||||
pub chain_id: u8,
|
pub chain_id: u8,
|
||||||
|
pub beacon_chain_topic: String,
|
||||||
|
pub shard_topic_prefix: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChainSpec {
|
impl ChainSpec {
|
||||||
@ -216,10 +217,12 @@ impl ChainSpec {
|
|||||||
domain_transfer: 5,
|
domain_transfer: 5,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Boot nodes
|
* Network specific
|
||||||
*/
|
*/
|
||||||
boot_nodes: vec![],
|
boot_nodes: vec![],
|
||||||
chain_id: 1, // mainnet chain id
|
chain_id: 1, // foundation chain id
|
||||||
|
beacon_chain_topic: String::from("beacon_chain"),
|
||||||
|
shard_topic_prefix: String::from("attestations"), // simple single attestation topic for now
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user