From 8c9d68041c417281c9df96b5a262a85cd00a0c80 Mon Sep 17 00:00:00 2001 From: Dave Hrycyszyn Date: Wed, 29 Jan 2020 12:49:51 +0000 Subject: [PATCH] validator: renamed tendermint integration --- validator/src/network/mod.rs | 2 +- .../{tendermint_abci.rs => tendermint.rs} | 24 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) rename validator/src/network/{tendermint_abci.rs => tendermint.rs} (80%) diff --git a/validator/src/network/mod.rs b/validator/src/network/mod.rs index cc58e96b21..6ad3fa6cb5 100644 --- a/validator/src/network/mod.rs +++ b/validator/src/network/mod.rs @@ -1,4 +1,4 @@ //! The `network` module provides interfaces to external systems via network //! connectivity. //! -pub mod tendermint_abci; +pub mod tendermint; diff --git a/validator/src/network/tendermint_abci.rs b/validator/src/network/tendermint.rs similarity index 80% rename from validator/src/network/tendermint_abci.rs rename to validator/src/network/tendermint.rs index 68358e08c2..c493dbb407 100644 --- a/validator/src/network/tendermint_abci.rs +++ b/validator/src/network/tendermint.rs @@ -1,9 +1,6 @@ -use crate::validator::Validator; use abci::*; use byteorder::{BigEndian, ByteOrder}; -use crypto::identity::{ - DummyMixIdentityKeyPair, DummyMixIdentityPrivateKey, DummyMixIdentityPublicKey, -}; +use serde_derive::Deserialize; // Convert incoming tx network data to the proper BigEndian size. txs.len() > 8 will return 0 fn convert_tx(tx: &[u8]) -> u64 { @@ -16,9 +13,18 @@ fn convert_tx(tx: &[u8]) -> u64 { BigEndian::read_u64(tx) } -impl abci::Application - for Validator -{ +#[derive(Debug, Deserialize)] +pub struct Abci { + count: u64, +} + +impl Abci { + pub fn new() -> Abci { + Abci { count: 0 } + } +} + +impl abci::Application for Abci { // Validate transactions. Rule: Transactions must be incremental: 1,2,3,4... fn check_tx(&mut self, req: &RequestCheckTx) -> ResponseCheckTx { // Get the Tx [u8] and convert to u64 @@ -57,8 +63,6 @@ impl abci::Application resp } } -pub async fn start( - app: Validator, -) { +pub async fn start(app: Abci) { abci::run_local(app); }