mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
consensus: Move p2p protocols into module.
This commit is contained in:
@@ -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!())]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
Reference in New Issue
Block a user