Remove sync crate, move into network crate

This commit is contained in:
Age Manning
2019-03-19 00:05:06 +11:00
parent 8ec0688cb9
commit 41abdb7599
10 changed files with 24 additions and 25 deletions

View File

@@ -2,16 +2,15 @@ use crate::beacon_chain::BeaconChain;
use crate::error;
use crate::messages::NodeMessage;
use crate::service::NetworkMessage;
use crate::sync::SimpleSync;
use crossbeam_channel::{unbounded as channel, Sender};
use futures::future;
use futures::prelude::*;
use libp2p::rpc;
use libp2p::{PeerId, RPCEvent};
use slog::debug;
use std::collections::HashMap;
use std::sync::Arc;
use std::time::{Duration, Instant};
use sync::SimpleSync;
use types::Hash256;
/// Timeout for establishing a HELLO handshake.
@@ -57,13 +56,11 @@ impl MessageHandler {
let (handler_send, handler_recv) = channel();
// Initialise sync and begin processing in thread
//TODO: Load genesis from BeaconChain
//TODO: Initialise beacon chain
let temp_genesis = Hash256::zero();
// generate the Message handler
let sync = SimpleSync::new(temp_genesis);
let sync = SimpleSync::new(beacon_chain.clone());
let mut handler = MessageHandler {
// TODO: The handler may not need a chain, perhaps only sync?
chain: beacon_chain.clone(),
sync,
network_send,