Fixed code appearance with rustfmt.
This commit is contained in:
parent
dc2fc7a250
commit
9e47cb56e7
@ -1,3 +1,4 @@
|
|||||||
|
use bincode;
|
||||||
use bls::Keypair;
|
use bls::Keypair;
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
@ -5,7 +6,6 @@ use std::fs::File;
|
|||||||
use std::io::{Error, ErrorKind};
|
use std::io::{Error, ErrorKind};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use types::ChainSpec;
|
use types::ChainSpec;
|
||||||
use bincode;
|
|
||||||
|
|
||||||
/// Stores the core configuration for this validator instance.
|
/// Stores the core configuration for this validator instance.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@ -31,10 +31,9 @@ impl ValidatorClientConfig {
|
|||||||
let data_dir: PathBuf = match arguments.value_of("datadir") {
|
let data_dir: PathBuf = match arguments.value_of("datadir") {
|
||||||
Some(path) => PathBuf::from(path.to_string()),
|
Some(path) => PathBuf::from(path.to_string()),
|
||||||
None => {
|
None => {
|
||||||
let home = dirs::home_dir().ok_or_else(|| Error::new(
|
let home = dirs::home_dir().ok_or_else(|| {
|
||||||
ErrorKind::NotFound,
|
Error::new(ErrorKind::NotFound, "Unable to determine home directory.")
|
||||||
"Unable to determine home directory.",
|
})?;
|
||||||
))?;
|
|
||||||
home.join(DEFAULT_VALIDATOR_DATADIR)
|
home.join(DEFAULT_VALIDATOR_DATADIR)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -96,13 +95,14 @@ impl ValidatorClientConfig {
|
|||||||
.map_err(|e| Error::new(ErrorKind::InvalidData, e))?;
|
.map_err(|e| Error::new(ErrorKind::InvalidData, e))?;
|
||||||
|
|
||||||
// TODO skip keyfile if it's not matched, and log the error instead of returning it.
|
// TODO skip keyfile if it's not matched, and log the error instead of returning it.
|
||||||
let validator_directory_name = validator_dir.file_name().into_string().map_err(|_| {
|
let validator_directory_name =
|
||||||
|
validator_dir.file_name().into_string().map_err(|_| {
|
||||||
Error::new(
|
Error::new(
|
||||||
ErrorKind::InvalidData,
|
ErrorKind::InvalidData,
|
||||||
"The filename cannot be parsed to a string.",
|
"The filename cannot be parsed to a string.",
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
if key.identifier() != validator_directory_name {
|
if key.identifier() != validator_directory_name {
|
||||||
return Err(Error::new(
|
return Err(Error::new(
|
||||||
ErrorKind::InvalidData,
|
ErrorKind::InvalidData,
|
||||||
"The validator directory ID did not match the key found inside.",
|
"The validator directory ID did not match the key found inside.",
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
pub mod config;
|
pub mod config;
|
||||||
|
|
||||||
pub use crate::config::ValidatorClientConfig;
|
pub use crate::config::ValidatorClientConfig;
|
||||||
|
@ -8,7 +8,7 @@ use protos::services_grpc::{BeaconBlockServiceClient, ValidatorServiceClient};
|
|||||||
use slog::{error, info, o, Drain};
|
use slog::{error, info, o, Drain};
|
||||||
use slot_clock::SystemTimeSlotClock;
|
use slot_clock::SystemTimeSlotClock;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::{thread, process, time};
|
use std::{process, thread, time};
|
||||||
|
|
||||||
mod block_producer_service;
|
mod block_producer_service;
|
||||||
mod config;
|
mod config;
|
||||||
@ -106,7 +106,6 @@ fn main() {
|
|||||||
*/
|
*/
|
||||||
let mut threads = vec![];
|
let mut threads = vec![];
|
||||||
|
|
||||||
|
|
||||||
for keypair in keypairs {
|
for keypair in keypairs {
|
||||||
info!(log, "Starting validator services"; "validator" => keypair.pk.concatenated_hex_id());
|
info!(log, "Starting validator services"; "validator" => keypair.pk.concatenated_hex_id());
|
||||||
let duties_map = Arc::new(EpochDutiesMap::new(spec.slots_per_epoch));
|
let duties_map = Arc::new(EpochDutiesMap::new(spec.slots_per_epoch));
|
||||||
|
Loading…
Reference in New Issue
Block a user