validator: Tendermint ABCI works with Validator struct.
This commit is contained in:
+16
-4
@@ -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 {
|
||||
|
||||
@@ -21,9 +21,10 @@ where
|
||||
Priv: MixnetIdentityPrivateKey,
|
||||
Pub: MixnetIdentityPublicKey,
|
||||
{
|
||||
pub count: u64,
|
||||
heath_check: HealthChecker<IDPair, Priv, Pub>,
|
||||
#[allow(dead_code)]
|
||||
identity_keypair: IDPair,
|
||||
heath_check: HealthChecker<IDPair, Priv, Pub>,
|
||||
}
|
||||
|
||||
// but for time being, since it's a dummy one, have it use dummy keys
|
||||
@@ -34,8 +35,9 @@ impl Validator<DummyMixIdentityKeyPair, DummyMixIdentityPrivateKey, DummyMixIden
|
||||
let dummy_keypair = DummyMixIdentityKeyPair::new();
|
||||
|
||||
Validator {
|
||||
identity_keypair: dummy_keypair.clone(),
|
||||
heath_check: HealthChecker::new(config.health_check, dummy_keypair),
|
||||
count: 0,
|
||||
heath_check: HealthChecker::new(config.health_check, dummy_keypair.clone()),
|
||||
identity_keypair: dummy_keypair,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user