mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-16 11:22:56 +00:00
Fix lcli testnet deployer
This commit is contained in:
@@ -23,3 +23,4 @@ futures = "0.1.25"
|
||||
environment = { path = "../lighthouse/environment" }
|
||||
web3 = "0.8.0"
|
||||
eth2_testnet = { path = "../eth2/utils/eth2_testnet" }
|
||||
dirs = "2.0"
|
||||
|
||||
@@ -159,8 +159,7 @@ fn main() {
|
||||
.short("o")
|
||||
.value_name("PATH")
|
||||
.takes_value(true)
|
||||
.default_value("~/.lighthouse/testnet")
|
||||
.help("The output directory."),
|
||||
.help("The output directory. Defaults to ~/.lighthouse/testnet"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("min_genesis_time")
|
||||
|
||||
@@ -6,6 +6,8 @@ use std::path::PathBuf;
|
||||
use types::EthSpec;
|
||||
use web3::{transports::Http, Web3};
|
||||
|
||||
pub const DEFAULT_DATA_DIR: &str = ".lighthouse/testnet";
|
||||
|
||||
pub fn new_testnet<T: EthSpec>(
|
||||
mut env: Environment<T>,
|
||||
matches: &ArgMatches,
|
||||
@@ -24,9 +26,16 @@ pub fn new_testnet<T: EthSpec>(
|
||||
|
||||
let output_dir = matches
|
||||
.value_of("output")
|
||||
.ok_or_else(|| "Output directory not specified")?
|
||||
.parse::<PathBuf>()
|
||||
.map_err(|e| format!("Failed to parse output directory: {}", e))?;
|
||||
.ok_or_else(|| ())
|
||||
.and_then(|output| output.parse::<PathBuf>().map_err(|_| ()))
|
||||
.unwrap_or_else(|_| {
|
||||
dirs::home_dir()
|
||||
.map(|mut home| {
|
||||
home.push(DEFAULT_DATA_DIR);
|
||||
home
|
||||
})
|
||||
.expect("should locate home directory")
|
||||
});
|
||||
|
||||
let endpoint = matches
|
||||
.value_of("endpoint")
|
||||
@@ -73,6 +82,8 @@ pub fn new_testnet<T: EthSpec>(
|
||||
deploy_block
|
||||
);
|
||||
|
||||
info!("Writing config to {:?}", output_dir);
|
||||
|
||||
Eth2TestnetDir::new(
|
||||
output_dir,
|
||||
format!("0x{}", deposit_contract.address()),
|
||||
|
||||
Reference in New Issue
Block a user