From 17a513d5fb39fb3bf4b6a103a0ac3ead4472ee04 Mon Sep 17 00:00:00 2001 From: Dave Hrycyszyn Date: Wed, 29 Jan 2020 09:31:01 +0000 Subject: [PATCH] validator: Tendermint ABCI works with Validator struct. --- validator/src/main.rs | 20 ++++++++++++++++---- validator/src/validator.rs | 8 +++++--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/validator/src/main.rs b/validator/src/main.rs index d964d8991a..832173d6d8 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -2,7 +2,6 @@ use crate::validator::Config; use crate::validator::Validator; use clap::{App, Arg, ArgMatches, SubCommand}; use log::{error, info, trace}; -use network::tendermint_abci; use std::process; use toml; @@ -28,7 +27,17 @@ fn main() { .required(true), ), ) - .subcommand(SubCommand::with_name("tm").about("Starts the Tendermint test app")) + .subcommand( + SubCommand::with_name("tm") + .about("Starts the Tendermint test app") + .arg( + Arg::with_name("config") + .long("config") + .help("Location of the validator configuration file") + .takes_value(true) + .required(true), + ), + ) .get_matches(); if let Err(e) = execute(arg_matches) { @@ -45,9 +54,12 @@ fn run(matches: &ArgMatches) { validator.start() } -fn tm(_matches: &ArgMatches) { +fn tm(matches: &ArgMatches) { + let config = parse_config(matches); + trace!("read config: {:?}", config); info!("Starting Tendermint app."); - abci::run_local(tendermint_abci::CounterApp::new()); + let validator = Validator::new(config); + abci::run_local(validator); } fn parse_config(matches: &ArgMatches) -> Config { diff --git a/validator/src/validator.rs b/validator/src/validator.rs index d9c220318f..1725def40b 100644 --- a/validator/src/validator.rs +++ b/validator/src/validator.rs @@ -21,9 +21,10 @@ where Priv: MixnetIdentityPrivateKey, Pub: MixnetIdentityPublicKey, { + pub count: u64, + heath_check: HealthChecker, #[allow(dead_code)] identity_keypair: IDPair, - heath_check: HealthChecker, } // but for time being, since it's a dummy one, have it use dummy keys @@ -34,8 +35,9 @@ impl Validator