Fixed code appearance with rustfmt.

This commit is contained in:
Luke Anderson 2019-03-20 16:27:58 +11:00
parent dc2fc7a250
commit 9e47cb56e7
No known key found for this signature in database
GPG Key ID: 44408169EC61E228
3 changed files with 9 additions and 10 deletions

View File

@ -1,3 +1,4 @@
use bincode;
use bls::Keypair;
use clap::ArgMatches;
use std::fs;
@ -5,7 +6,6 @@ use std::fs::File;
use std::io::{Error, ErrorKind};
use std::path::PathBuf;
use types::ChainSpec;
use bincode;
/// Stores the core configuration for this validator instance.
#[derive(Clone)]
@ -31,10 +31,9 @@ impl ValidatorClientConfig {
let data_dir: PathBuf = match arguments.value_of("datadir") {
Some(path) => PathBuf::from(path.to_string()),
None => {
let home = dirs::home_dir().ok_or_else(|| Error::new(
ErrorKind::NotFound,
"Unable to determine home directory.",
))?;
let home = dirs::home_dir().ok_or_else(|| {
Error::new(ErrorKind::NotFound, "Unable to determine home directory.")
})?;
home.join(DEFAULT_VALIDATOR_DATADIR)
}
};
@ -96,13 +95,14 @@ impl ValidatorClientConfig {
.map_err(|e| Error::new(ErrorKind::InvalidData, e))?;
// 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(
ErrorKind::InvalidData,
"The filename cannot be parsed to a string.",
)
})?;
if key.identifier() != validator_directory_name {
if key.identifier() != validator_directory_name {
return Err(Error::new(
ErrorKind::InvalidData,
"The validator directory ID did not match the key found inside.",

View File

@ -1,3 +1,3 @@
pub mod config;
pub use crate::config::ValidatorClientConfig;
pub use crate::config::ValidatorClientConfig;

View File

@ -8,7 +8,7 @@ use protos::services_grpc::{BeaconBlockServiceClient, ValidatorServiceClient};
use slog::{error, info, o, Drain};
use slot_clock::SystemTimeSlotClock;
use std::sync::Arc;
use std::{thread, process, time};
use std::{process, thread, time};
mod block_producer_service;
mod config;
@ -106,7 +106,6 @@ fn main() {
*/
let mut threads = vec![];
for keypair in keypairs {
info!(log, "Starting validator services"; "validator" => keypair.pk.concatenated_hex_id());
let duties_map = Arc::new(EpochDutiesMap::new(spec.slots_per_epoch));