Skip to content

Commit bbecb04

Browse files
authored
Remove eth/63 protocol version (openethereum#252)
* Remove eth/63 protocol
1 parent 6d81fce commit bbecb04

File tree

3 files changed

+14
-24
lines changed

3 files changed

+14
-24
lines changed

crates/ethcore/sync/src/api.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ use std::{
3131

3232
use chain::{
3333
fork_filter::ForkFilterApi, ChainSyncApi, SyncState, SyncStatus as EthSyncStatus,
34-
ETH_PROTOCOL_VERSION_63, ETH_PROTOCOL_VERSION_64, PAR_PROTOCOL_VERSION_1,
35-
PAR_PROTOCOL_VERSION_2,
34+
ETH_PROTOCOL_VERSION_64, PAR_PROTOCOL_VERSION_1, PAR_PROTOCOL_VERSION_2,
3635
};
3736
use ethcore::{
3837
client::{BlockChainClient, ChainMessageType, ChainNotify, NewBlocks},
@@ -576,7 +575,7 @@ impl ChainNotify for EthSync {
576575
.register_protocol(
577576
self.eth_handler.clone(),
578577
self.subprotocol_name,
579-
&[ETH_PROTOCOL_VERSION_63, ETH_PROTOCOL_VERSION_64],
578+
&[ETH_PROTOCOL_VERSION_64],
580579
)
581580
.unwrap_or_else(|e| warn!("Error registering ethereum protocol: {:?}", e));
582581
// register the warp sync subprotocol

crates/ethcore/sync/src/chain/handler.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ use super::sync_packet::{
4242

4343
use super::{
4444
BlockSet, ChainSync, ForkConfirmation, PacketProcessError, PeerAsking, PeerInfo, SyncRequester,
45-
SyncState, ETH_PROTOCOL_VERSION_63, ETH_PROTOCOL_VERSION_64, MAX_NEW_BLOCK_AGE, MAX_NEW_HASHES,
46-
PAR_PROTOCOL_VERSION_1, PAR_PROTOCOL_VERSION_2,
45+
SyncState, ETH_PROTOCOL_VERSION_64, MAX_NEW_BLOCK_AGE, MAX_NEW_HASHES, PAR_PROTOCOL_VERSION_1,
46+
PAR_PROTOCOL_VERSION_2,
4747
};
4848

4949
/// The Chain Sync Handler: handles responses from peers
@@ -669,7 +669,7 @@ impl SyncHandler {
669669
.next()
670670
.ok_or(rlp::DecoderError::RlpIsTooShort)?
671671
.as_val()?;
672-
let eth_protocol_version = io.protocol_version(&ETH_PROTOCOL, peer_id);
672+
let _eth_protocol_version = io.protocol_version(&ETH_PROTOCOL, peer_id);
673673
let warp_protocol_version = io.protocol_version(&PAR_PROTOCOL, peer_id);
674674
let warp_protocol = warp_protocol_version != 0;
675675

@@ -692,16 +692,12 @@ impl SyncHandler {
692692
.ok_or(rlp::DecoderError::RlpIsTooShort)?
693693
.as_val()?;
694694
let forkid_validation_error = {
695-
if eth_protocol_version >= ETH_PROTOCOL_VERSION_64.0 {
696-
let fork_id = rlp04::Rlp::new(r.as_raw()).val_at(5)?;
697-
r_iter.next().ok_or(rlp::DecoderError::RlpIsTooShort)?;
698-
sync.fork_filter
699-
.is_compatible(io.chain(), fork_id)
700-
.err()
701-
.map(|e| (fork_id, e))
702-
} else {
703-
None
704-
}
695+
let fork_id = rlp04::Rlp::new(r.as_raw()).val_at(5)?;
696+
r_iter.next().ok_or(rlp::DecoderError::RlpIsTooShort)?;
697+
sync.fork_filter
698+
.is_compatible(io.chain(), fork_id)
699+
.err()
700+
.map(|e| (fork_id, e))
705701
};
706702
let snapshot_hash = if warp_protocol {
707703
Some(
@@ -790,9 +786,7 @@ impl SyncHandler {
790786
|| (warp_protocol
791787
&& (peer.protocol_version < PAR_PROTOCOL_VERSION_1.0
792788
|| peer.protocol_version > PAR_PROTOCOL_VERSION_2.0))
793-
|| (!warp_protocol
794-
&& (peer.protocol_version < ETH_PROTOCOL_VERSION_63.0
795-
|| peer.protocol_version > ETH_PROTOCOL_VERSION_64.0))
789+
|| (!warp_protocol && peer.protocol_version != ETH_PROTOCOL_VERSION_64.0)
796790
{
797791
trace!(target: "sync", "Peer {} unsupported eth protocol ({})", peer_id, peer.protocol_version);
798792
return Err(DownloaderImportError::Invalid);

crates/ethcore/sync/src/chain/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ impl From<DecoderError> for PacketProcessError {
155155

156156
/// 64 version of Ethereum protocol.
157157
pub const ETH_PROTOCOL_VERSION_64: (u8, u8) = (64, 0x11);
158-
/// 63 version of Ethereum protocol.
159-
pub const ETH_PROTOCOL_VERSION_63: (u8, u8) = (63, 0x11);
160158
/// 1 version of OpenEthereum protocol and the packet count.
161159
pub const PAR_PROTOCOL_VERSION_1: (u8, u8) = (1, 0x15);
162160
/// 2 version of OpenEthereum protocol (consensus messages added).
@@ -1292,9 +1290,8 @@ impl ChainSync {
12921290
packet.append(&primitive_types07::U256(chain.total_difficulty.0));
12931291
packet.append(&primitive_types07::H256(chain.best_block_hash.0));
12941292
packet.append(&primitive_types07::H256(chain.genesis_hash.0));
1295-
if eth_protocol_version >= ETH_PROTOCOL_VERSION_64.0 {
1296-
packet.append(&self.fork_filter.current(io.chain()));
1297-
}
1293+
packet.append(&self.fork_filter.current(io.chain()));
1294+
12981295
if warp_protocol {
12991296
let manifest = io.snapshot_service().manifest();
13001297
let block_number = manifest.as_ref().map_or(0, |m| m.block_number);

0 commit comments

Comments
 (0)