Updates for latest master
This commit is contained in:
		
							parent
							
								
									43135484ca
								
							
						
					
					
						commit
						c7e17c8641
					
				| @ -23,19 +23,6 @@ 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)); |  | ||||||
| 
 |  | ||||||
|         // currently lighthouse spec
 |  | ||||||
|         let default_spec = ChainSpec::lighthouse_testnet(); |  | ||||||
|         let chain_type = ChainType::from(default_spec.chain_id); |  | ||||||
|         // builds a chain-specific network config
 |  | ||||||
|         let net_conf = NetworkConfig::from(chain_type); |  | ||||||
| 
 |  | ||||||
|         Self { |         Self { | ||||||
|             data_dir: PathBuf::from(".lighthouse"), |             data_dir: PathBuf::from(".lighthouse"), | ||||||
|             db_type: "disk".to_string(), |             db_type: "disk".to_string(), | ||||||
| @ -50,13 +37,19 @@ impl Default for ClientConfig { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl ClientConfig { | impl ClientConfig { | ||||||
| <<<<<<< HEAD |  | ||||||
|     /// Returns the path to which the client may initialize an on-disk database.
 |     /// Returns the path to which the client may initialize an on-disk database.
 | ||||||
|     pub fn db_path(&self) -> Option<PathBuf> { |     pub fn db_path(&self) -> Option<PathBuf> { | ||||||
|         self.data_dir() |         self.data_dir() | ||||||
|             .and_then(|path| Some(path.join(&self.db_name))) |             .and_then(|path| Some(path.join(&self.db_name))) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /// Returns the core path for the client.
 | ||||||
|  |     pub fn data_dir(&self) -> Option<PathBuf> { | ||||||
|  |         let path = dirs::home_dir()?.join(&self.data_dir); | ||||||
|  |         fs::create_dir_all(&path).ok()?; | ||||||
|  |         Some(path) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /// Apply the following arguments to `self`, replacing values if they are specified in `args`.
 |     /// Apply the following arguments to `self`, replacing values if they are specified in `args`.
 | ||||||
|     ///
 |     ///
 | ||||||
|     /// Returns an error if arguments are obviously invalid. May succeed even if some values are
 |     /// Returns an error if arguments are obviously invalid. May succeed even if some values are
 | ||||||
| @ -74,6 +67,6 @@ impl ClientConfig { | |||||||
|         self.rpc.apply_cli_args(args)?; |         self.rpc.apply_cli_args(args)?; | ||||||
|         self.http.apply_cli_args(args)?; |         self.http.apply_cli_args(args)?; | ||||||
| 
 | 
 | ||||||
|         Ok(log) |         Ok(()) | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -7,9 +7,8 @@ edition = "2018" | |||||||
| [dependencies] | [dependencies] | ||||||
| beacon_chain =  { path = "../beacon_chain" } | beacon_chain =  { path = "../beacon_chain" } | ||||||
| clap = "2.32.0" | clap = "2.32.0" | ||||||
| # SigP repository until PR is merged | # SigP repository  | ||||||
| #libp2p =  { git = "https://github.com/SigP/rust-libp2p", rev = "fb852bcc2b9b3935555cc93930e913cbec2b0688" } | libp2p =  { git = "https://github.com/SigP/rust-libp2p", rev = "8d5e5bbbe32d07ad271d6a2e15fde0347894061a" } | ||||||
| libp2p =  { path = "../../../sharding/rust-libp2p" } |  | ||||||
| types = { path =  "../../eth2/types" } | types = { path =  "../../eth2/types" } | ||||||
| serde = "1.0" | serde = "1.0" | ||||||
| serde_derive = "1.0" | serde_derive = "1.0" | ||||||
|  | |||||||
| @ -147,11 +147,7 @@ impl<TSubstream: AsyncRead + AsyncWrite> Behaviour<TSubstream> { | |||||||
|     pub fn new(local_public_key: PublicKey, net_conf: &NetworkConfig, log: &slog::Logger) -> Self { |     pub fn new(local_public_key: PublicKey, net_conf: &NetworkConfig, log: &slog::Logger) -> Self { | ||||||
|         let local_peer_id = local_public_key.clone().into_peer_id(); |         let local_peer_id = local_public_key.clone().into_peer_id(); | ||||||
|         let behaviour_log = log.new(o!()); |         let behaviour_log = log.new(o!()); | ||||||
| 
 |  | ||||||
|         // identify configuration
 |  | ||||||
|         let identify_config = net_conf.identify_config.clone(); |         let identify_config = net_conf.identify_config.clone(); | ||||||
| 
 |  | ||||||
|         // ping configuration
 |  | ||||||
|         let ping_config = PingConfig::new() |         let ping_config = PingConfig::new() | ||||||
|             .with_timeout(Duration::from_secs(30)) |             .with_timeout(Duration::from_secs(30)) | ||||||
|             .with_interval(Duration::from_secs(20)) |             .with_interval(Duration::from_secs(20)) | ||||||
|  | |||||||
| @ -107,6 +107,7 @@ pub struct ChainSpec { | |||||||
|     /* |     /* | ||||||
|      * Network specific parameters |      * Network specific parameters | ||||||
|      */ |      */ | ||||||
|  |     pub boot_nodes: Vec<Multiaddr>, | ||||||
|     pub chain_id: u8, |     pub chain_id: u8, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -216,7 +217,8 @@ impl ChainSpec { | |||||||
|             /* |             /* | ||||||
|              * Network specific |              * Network specific | ||||||
|              */ |              */ | ||||||
|             chain_id: 1, // foundation chain id
 |             boot_nodes: vec![], | ||||||
|  |             chain_id: 1, // mainnet chain id
 | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user