mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 12:58:31 +00:00
Merge latest master
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
/// Pulls down the latest Lighthouse testnet from https://github.com/eth2-clients/eth2-testnets
|
||||
//! Downloads a testnet configuration from Github.
|
||||
|
||||
use reqwest;
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
|
||||
const TESTNET_ID: &str = "testnet5";
|
||||
const TESTNET_ID: &str = "schlesi-v0-11";
|
||||
|
||||
fn main() {
|
||||
if !base_dir().exists() {
|
||||
@@ -37,16 +38,25 @@ pub fn get_all_files() -> Result<(), String> {
|
||||
|
||||
pub fn get_file(filename: &str) -> Result<(), String> {
|
||||
let url = format!(
|
||||
"https://raw.githubusercontent.com/eth2-clients/eth2-testnets/master/lighthouse/{}/{}",
|
||||
TESTNET_ID, filename
|
||||
"https://raw.githubusercontent.com/goerli/schlesi/839866fe29a1b4df3a87bfe2ff1257c8a58671c9/light/{}",
|
||||
filename
|
||||
);
|
||||
|
||||
let path = base_dir().join(filename);
|
||||
let mut file =
|
||||
File::create(path).map_err(|e| format!("Failed to create {}: {:?}", filename, e))?;
|
||||
|
||||
let contents = reqwest::blocking::get(&url)
|
||||
let request = reqwest::blocking::Client::builder()
|
||||
.build()
|
||||
.map_err(|_| "Could not build request client".to_string())?
|
||||
.get(&url)
|
||||
.timeout(std::time::Duration::from_secs(120));
|
||||
|
||||
let contents = request
|
||||
.send()
|
||||
.map_err(|e| format!("Failed to download {}: {}", filename, e))?
|
||||
.error_for_status()
|
||||
.map_err(|e| format!("Error downloading {}: {}", filename, e))?
|
||||
.bytes()
|
||||
.map_err(|e| format!("Failed to read {} response bytes: {}", filename, e))?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user