consensus: Move p2p protocols into module.

This commit is contained in:
parazyd
2022-04-16 15:19:04 +02:00
parent df13dc12f4
commit 305699a363
7 changed files with 15 additions and 14 deletions

View File

@@ -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!())]

View File

@@ -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

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,