feat: added consensus and networking mocks

This commit is contained in:
Oleksandr Pravdyvyi
2024-10-04 06:16:13 +03:00
parent 3ba1b77cf2
commit 8de1d226f0
10 changed files with 126 additions and 2 deletions
+1
View File
@@ -9,6 +9,7 @@ serde_json.workspace = true
env_logger.workspace = true
log.workspace = true
serde.workspace = true
tokio.workspace = true
[dependencies.networking]
path = "../networking"
+22 -1
View File
@@ -1 +1,22 @@
//ToDo: Add consensus module
use std::sync::Arc;
use networking::peer_manager::PeerManager;
use tokio::sync::Mutex;
#[derive(Debug)]
///Entrypoint to consensus.
/// Manages consensus protocol.
pub struct ConsensusManager {
pub peer_manager: Arc<Mutex<PeerManager>>,
}
impl ConsensusManager {
pub fn new(peer_manager: Arc<Mutex<PeerManager>>) -> Self {
Self { peer_manager }
}
//ToDo: change block from generic value into struct, when data block will be defined
pub fn vote(&self, _block: serde_json::Value) -> bool {
todo!()
}
}