mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 05:44:44 +00:00
Misc. dependency cleanup (#6810)
* remove ensure_dir_exists (2 deps saved) * group UNHANDLED_ERRORs into a generic (2 deps saved) * Introduce separate `health_metrics` crate * separate health_metrics crate * remove metrics from warp_utils * move ProcessHealth::observe and SystemHealth::observe to health_metrics * fix errors * nitpick `Cargo.toml`s --------- Co-authored-by: Daniel Knopik <daniel@dknopik.de> # Conflicts: # Cargo.toml
This commit is contained in:
@@ -4,13 +4,12 @@
|
||||
//! attempt) to load into the `crate::intialized_validators::InitializedValidators` struct.
|
||||
|
||||
use crate::{default_keystore_password_path, read_password_string, write_file_via_temporary};
|
||||
use directory::ensure_dir_exists;
|
||||
use eth2_keystore::Keystore;
|
||||
use regex::Regex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use slog::{error, Logger};
|
||||
use std::collections::HashSet;
|
||||
use std::fs::{self, File};
|
||||
use std::fs::{self, create_dir_all, File};
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
use types::{graffiti::GraffitiString, Address, PublicKey};
|
||||
@@ -229,7 +228,7 @@ impl From<Vec<ValidatorDefinition>> for ValidatorDefinitions {
|
||||
impl ValidatorDefinitions {
|
||||
/// Open an existing file or create a new, empty one if it does not exist.
|
||||
pub fn open_or_create<P: AsRef<Path>>(validators_dir: P) -> Result<Self, Error> {
|
||||
ensure_dir_exists(validators_dir.as_ref()).map_err(|_| {
|
||||
create_dir_all(validators_dir.as_ref()).map_err(|_| {
|
||||
Error::UnableToCreateValidatorDir(PathBuf::from(validators_dir.as_ref()))
|
||||
})?;
|
||||
let config_path = validators_dir.as_ref().join(CONFIG_FILENAME);
|
||||
|
||||
Reference in New Issue
Block a user