Implement skeleton network/sync framework.

This commit is contained in:
Age Manning
2019-03-04 18:31:01 +11:00
parent 3b8f29a914
commit b68adc1ae3
16 changed files with 147 additions and 39 deletions

View File

@@ -1,27 +1,26 @@
use types::{H256,Slot}
use libp2p::PeerId;
use types::{Hash256, Slot};
/// Messages between nodes across the network.
pub enum NodeMessage {
Status(Status),
BlockRequest,
}
pub struct Status {
/// Current node version.
version: u8
/// Genesis Hash.
genesis_hash: H256
/// Best known slot number.
best_slot: Slot
/// Best known slot hash.
best_slot_hash: H256
/// Current node version.
version: u8,
/// Genesis Hash.
genesis_hash: Hash256,
/// Best known slot number.
best_slot: Slot,
/// Best known slot hash.
best_slot_hash: Hash256,
}
/// Types of messages that the network service can receive.
pub enum NetworkMessage {
/// Send a message to libp2p service.
//TODO: Define typing for messages accross the wire
Send(Node, Message),
//TODO: Define typing for messages across the wire
Send(PeerId, NodeMessage),
}