feat: ✨ receive calculated block for server
feat: ✨ somewhat consensus structure
This commit is contained in:
parent
e7d10c46f8
commit
92b748ab6a
7 changed files with 206 additions and 24 deletions
31
src/lib.rs
31
src/lib.rs
|
@ -1,8 +1,13 @@
|
|||
use std::net::IpAddr;
|
||||
|
||||
use block::Block;
|
||||
use tokio::sync::broadcast::Receiver;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub mod block;
|
||||
pub mod blockchain;
|
||||
pub mod client_network;
|
||||
pub mod consensus;
|
||||
pub mod server_network;
|
||||
mod test;
|
||||
pub mod utils;
|
||||
|
@ -20,3 +25,29 @@ pub struct ClientConfig {
|
|||
pub server_address: IpAddr,
|
||||
pub port: u16,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct BlockReceiver {
|
||||
pub block_receiver: Receiver<Block>,
|
||||
pub uuid: Uuid,
|
||||
}
|
||||
|
||||
impl Ord for BlockReceiver {
|
||||
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
|
||||
self.uuid.cmp(&other.uuid)
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialOrd for BlockReceiver {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||
self.uuid.partial_cmp(&other.uuid)
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for BlockReceiver {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.uuid == other.uuid
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for BlockReceiver {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue