diff --git a/crates/ethcore/sync/src/api.rs b/crates/ethcore/sync/src/api.rs index a512d7a83..18d662597 100644 --- a/crates/ethcore/sync/src/api.rs +++ b/crates/ethcore/sync/src/api.rs @@ -31,8 +31,7 @@ use std::{ use chain::{ fork_filter::ForkFilterApi, ChainSyncApi, SyncState, SyncStatus as EthSyncStatus, - ETH_PROTOCOL_VERSION_63, ETH_PROTOCOL_VERSION_64, PAR_PROTOCOL_VERSION_1, - PAR_PROTOCOL_VERSION_2, + ETH_PROTOCOL_VERSION_64, PAR_PROTOCOL_VERSION_1, PAR_PROTOCOL_VERSION_2, }; use ethcore::{ client::{BlockChainClient, ChainMessageType, ChainNotify, NewBlocks}, @@ -576,7 +575,7 @@ impl ChainNotify for EthSync { .register_protocol( self.eth_handler.clone(), self.subprotocol_name, - &[ETH_PROTOCOL_VERSION_63, ETH_PROTOCOL_VERSION_64], + &[ETH_PROTOCOL_VERSION_64], ) .unwrap_or_else(|e| warn!("Error registering ethereum protocol: {:?}", e)); // register the warp sync subprotocol diff --git a/crates/ethcore/sync/src/chain/handler.rs b/crates/ethcore/sync/src/chain/handler.rs index 2aa9c5c6e..029c6659d 100644 --- a/crates/ethcore/sync/src/chain/handler.rs +++ b/crates/ethcore/sync/src/chain/handler.rs @@ -42,8 +42,8 @@ use super::sync_packet::{ use super::{ BlockSet, ChainSync, ForkConfirmation, PacketProcessError, PeerAsking, PeerInfo, SyncRequester, - SyncState, ETH_PROTOCOL_VERSION_63, ETH_PROTOCOL_VERSION_64, MAX_NEW_BLOCK_AGE, MAX_NEW_HASHES, - PAR_PROTOCOL_VERSION_1, PAR_PROTOCOL_VERSION_2, + SyncState, ETH_PROTOCOL_VERSION_64, MAX_NEW_BLOCK_AGE, MAX_NEW_HASHES, PAR_PROTOCOL_VERSION_1, + PAR_PROTOCOL_VERSION_2, }; /// The Chain Sync Handler: handles responses from peers @@ -669,7 +669,7 @@ impl SyncHandler { .next() .ok_or(rlp::DecoderError::RlpIsTooShort)? .as_val()?; - let eth_protocol_version = io.protocol_version(Ð_PROTOCOL, peer_id); + let _eth_protocol_version = io.protocol_version(Ð_PROTOCOL, peer_id); let warp_protocol_version = io.protocol_version(&PAR_PROTOCOL, peer_id); let warp_protocol = warp_protocol_version != 0; @@ -692,16 +692,12 @@ impl SyncHandler { .ok_or(rlp::DecoderError::RlpIsTooShort)? .as_val()?; let forkid_validation_error = { - if eth_protocol_version >= ETH_PROTOCOL_VERSION_64.0 { - let fork_id = rlp04::Rlp::new(r.as_raw()).val_at(5)?; - r_iter.next().ok_or(rlp::DecoderError::RlpIsTooShort)?; - sync.fork_filter - .is_compatible(io.chain(), fork_id) - .err() - .map(|e| (fork_id, e)) - } else { - None - } + let fork_id = rlp04::Rlp::new(r.as_raw()).val_at(5)?; + r_iter.next().ok_or(rlp::DecoderError::RlpIsTooShort)?; + sync.fork_filter + .is_compatible(io.chain(), fork_id) + .err() + .map(|e| (fork_id, e)) }; let snapshot_hash = if warp_protocol { Some( @@ -790,9 +786,7 @@ impl SyncHandler { || (warp_protocol && (peer.protocol_version < PAR_PROTOCOL_VERSION_1.0 || peer.protocol_version > PAR_PROTOCOL_VERSION_2.0)) - || (!warp_protocol - && (peer.protocol_version < ETH_PROTOCOL_VERSION_63.0 - || peer.protocol_version > ETH_PROTOCOL_VERSION_64.0)) + || (!warp_protocol && peer.protocol_version != ETH_PROTOCOL_VERSION_64.0) { trace!(target: "sync", "Peer {} unsupported eth protocol ({})", peer_id, peer.protocol_version); return Err(DownloaderImportError::Invalid); diff --git a/crates/ethcore/sync/src/chain/mod.rs b/crates/ethcore/sync/src/chain/mod.rs index e6a869d71..4536ad2fe 100644 --- a/crates/ethcore/sync/src/chain/mod.rs +++ b/crates/ethcore/sync/src/chain/mod.rs @@ -155,8 +155,6 @@ impl From for PacketProcessError { /// 64 version of Ethereum protocol. pub const ETH_PROTOCOL_VERSION_64: (u8, u8) = (64, 0x11); -/// 63 version of Ethereum protocol. -pub const ETH_PROTOCOL_VERSION_63: (u8, u8) = (63, 0x11); /// 1 version of OpenEthereum protocol and the packet count. pub const PAR_PROTOCOL_VERSION_1: (u8, u8) = (1, 0x15); /// 2 version of OpenEthereum protocol (consensus messages added). @@ -1292,9 +1290,8 @@ impl ChainSync { packet.append(&primitive_types07::U256(chain.total_difficulty.0)); packet.append(&primitive_types07::H256(chain.best_block_hash.0)); packet.append(&primitive_types07::H256(chain.genesis_hash.0)); - if eth_protocol_version >= ETH_PROTOCOL_VERSION_64.0 { - packet.append(&self.fork_filter.current(io.chain())); - } + packet.append(&self.fork_filter.current(io.chain())); + if warp_protocol { let manifest = io.snapshot_service().manifest(); let block_number = manifest.as_ref().map_or(0, |m| m.block_number);