diff --git a/bin/darkfid2/src/main.rs b/bin/darkfid2/src/main.rs index a316da7a7..444d9fcd3 100644 --- a/bin/darkfid2/src/main.rs +++ b/bin/darkfid2/src/main.rs @@ -17,8 +17,10 @@ use url::Url; use darkfi::{ cli_desc, consensus2::{ - state::ValidatorStatePtr, util::Timestamp, Tx, ValidatorState, MAINNET_GENESIS_HASH_BYTES, - TESTNET_GENESIS_HASH_BYTES, + proto::{ProtocolParticipant, ProtocolProposal, ProtocolTx, ProtocolVote}, + state::ValidatorStatePtr, + util::Timestamp, + Tx, ValidatorState, MAINNET_GENESIS_HASH_BYTES, TESTNET_GENESIS_HASH_BYTES, }, crypto::{ address::Address, @@ -49,16 +51,12 @@ use client::Client; mod error; use error::{server_error, RpcError}; -mod protocol; -use protocol::{ProtocolParticipant, ProtocolProposal, ProtocolTx, ProtocolVote}; - mod consensus; use consensus::proposal_task; const CONFIG_FILE: &str = "darkfid_config.toml"; const CONFIG_FILE_CONTENTS: &str = include_str!("../darkfid_config.toml"); -// TODO: Flag to participate in consensus #[derive(Clone, Debug, Deserialize, StructOpt, StructOptToml)] #[serde(default)] #[structopt(name = "darkfid", about = cli_desc!())] diff --git a/src/consensus2/mod.rs b/src/consensus2/mod.rs index 06367e924..2f8a164cc 100644 --- a/src/consensus2/mod.rs +++ b/src/consensus2/mod.rs @@ -26,6 +26,9 @@ pub use state::{ValidatorState, ValidatorStatePtr}; pub mod util; pub use util::Timestamp; +/// P2P net protocols +pub mod proto; + use lazy_static::lazy_static; lazy_static! { /// Genesis hash for the mainnet chain diff --git a/bin/darkfid2/src/protocol/mod.rs b/src/consensus2/proto/mod.rs similarity index 100% rename from bin/darkfid2/src/protocol/mod.rs rename to src/consensus2/proto/mod.rs diff --git a/bin/darkfid2/src/protocol/protocol_participant.rs b/src/consensus2/proto/protocol_participant.rs similarity index 97% rename from bin/darkfid2/src/protocol/protocol_participant.rs rename to src/consensus2/proto/protocol_participant.rs index 96809b8a0..9871b5cde 100644 --- a/bin/darkfid2/src/protocol/protocol_participant.rs +++ b/src/consensus2/proto/protocol_participant.rs @@ -3,8 +3,8 @@ use async_std::sync::Arc; use async_trait::async_trait; use log::debug; -use darkfi::{ - consensus2::{state::ValidatorStatePtr, Participant}, +use crate::{ + consensus2::{Participant, ValidatorStatePtr}, net::{ ChannelPtr, MessageSubscription, P2pPtr, ProtocolBase, ProtocolBasePtr, ProtocolJobsManager, ProtocolJobsManagerPtr, diff --git a/bin/darkfid2/src/protocol/protocol_proposal.rs b/src/consensus2/proto/protocol_proposal.rs similarity index 97% rename from bin/darkfid2/src/protocol/protocol_proposal.rs rename to src/consensus2/proto/protocol_proposal.rs index ff47d3ec0..f0de815fc 100644 --- a/bin/darkfid2/src/protocol/protocol_proposal.rs +++ b/src/consensus2/proto/protocol_proposal.rs @@ -3,8 +3,8 @@ use async_std::sync::Arc; use async_trait::async_trait; use log::debug; -use darkfi::{ - consensus2::{block::BlockProposal, state::ValidatorStatePtr}, +use crate::{ + consensus2::{BlockProposal, ValidatorStatePtr}, net::{ ChannelPtr, MessageSubscription, P2pPtr, ProtocolBase, ProtocolBasePtr, ProtocolJobsManager, ProtocolJobsManagerPtr, diff --git a/bin/darkfid2/src/protocol/protocol_tx.rs b/src/consensus2/proto/protocol_tx.rs similarity index 96% rename from bin/darkfid2/src/protocol/protocol_tx.rs rename to src/consensus2/proto/protocol_tx.rs index 65ec4a80b..d9f2e9c86 100644 --- a/bin/darkfid2/src/protocol/protocol_tx.rs +++ b/src/consensus2/proto/protocol_tx.rs @@ -3,8 +3,8 @@ use async_std::sync::Arc; use async_trait::async_trait; use log::debug; -use darkfi::{ - consensus2::{state::ValidatorStatePtr, Tx}, +use crate::{ + consensus2::{Tx, ValidatorStatePtr}, net::{ ChannelPtr, MessageSubscription, P2pPtr, ProtocolBase, ProtocolBasePtr, ProtocolJobsManager, ProtocolJobsManagerPtr, diff --git a/bin/darkfid2/src/protocol/protocol_vote.rs b/src/consensus2/proto/protocol_vote.rs similarity index 96% rename from bin/darkfid2/src/protocol/protocol_vote.rs rename to src/consensus2/proto/protocol_vote.rs index 4eb61ba24..7818ef4a1 100644 --- a/bin/darkfid2/src/protocol/protocol_vote.rs +++ b/src/consensus2/proto/protocol_vote.rs @@ -3,8 +3,8 @@ use async_std::sync::Arc; use async_trait::async_trait; use log::debug; -use darkfi::{ - consensus2::{state::ValidatorStatePtr, Vote}, +use crate::{ + consensus2::{ValidatorStatePtr, Vote}, net::{ ChannelPtr, MessageSubscription, P2pPtr, ProtocolBase, ProtocolBasePtr, ProtocolJobsManager, ProtocolJobsManagerPtr,