Move snapshot sync to a subprotocol (#2820)

This commit is contained in:
Arkadiy Paronyan
2016-10-24 16:24:35 +02:00
committed by Gav Wood
parent ff347da8d3
commit 9ec091e0cf
9 changed files with 92 additions and 36 deletions

View File

@@ -21,6 +21,7 @@ use ethcore::client::{TestBlockChainClient, BlockChainClient};
use ethcore::header::BlockNumber;
use ethcore::snapshot::SnapshotService;
use sync_io::SyncIo;
use api::WARP_SYNC_PROTOCOL_ID;
use chain::ChainSync;
use ::SyncConfig;
@@ -90,7 +91,11 @@ impl<'p> SyncIo for TestIo<'p> {
}
fn eth_protocol_version(&self, _peer: PeerId) -> u8 {
64
63
}
fn protocol_version(&self, protocol: &ProtocolId, peer_id: PeerId) -> u8 {
if protocol == &WARP_SYNC_PROTOCOL_ID { 1 } else { self.eth_protocol_version(peer_id) }
}
fn chain_overlay(&self) -> &RwLock<HashMap<BlockNumber, Bytes>> {