Basic networking service with channel

This commit is contained in:
Age Manning
2019-03-12 17:28:11 +11:00
parent 21032334ac
commit ae983a9347
13 changed files with 224 additions and 29 deletions

View File

@@ -2,11 +2,15 @@ use libp2p::PeerId;
use types::{Hash256, Slot};
/// Messages between nodes across the network.
#[derive(Debug, Clone)]
pub enum NodeMessage {
Status(Status),
BlockRequest,
// TODO: only for testing - remove
Message(String),
}
#[derive(Debug, Clone)]
pub struct Status {
/// Current node version.
version: u8,
@@ -19,6 +23,7 @@ pub struct Status {
}
/// Types of messages that the network service can receive.
#[derive(Debug, Clone)]
pub enum NetworkMessage {
/// Send a message to libp2p service.
//TODO: Define typing for messages across the wire