From 43ec3d8f79b0435be55c87af1586c73e750b99d3 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 5 Dec 2016 06:54:31 -0800 Subject: [PATCH] network_id -> u64 --- parity/cli/mod.rs | 6 +++--- parity/configuration.rs | 2 +- parity/run.rs | 4 ++-- rpc/src/v1/tests/helpers/sync_provider.rs | 2 +- sync/src/api.rs | 2 +- sync/src/chain.rs | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index d33c58d9d..7fcdd2209 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -48,7 +48,7 @@ usage! { flag_testnet: bool, flag_import_geth_keys: bool, flag_datadir: Option, - flag_networkid: Option, + flag_networkid: Option, flag_peers: Option, flag_nodekey: Option, flag_nodiscover: bool, @@ -122,7 +122,7 @@ usage! { or |c: &Config| otry!(c.network).nat.clone(), flag_allow_ips: String = "all", or |c: &Config| otry!(c.network).allow_ips.clone(), - flag_network_id: Option = None, + flag_network_id: Option = None, or |c: &Config| otry!(c.network).id.clone().map(Some), flag_bootnodes: Option = None, or |c: &Config| otry!(c.network).bootnodes.clone().map(|vec| Some(vec.join(","))), @@ -328,7 +328,7 @@ struct Network { max_pending_peers: Option, nat: Option, allow_ips: Option, - id: Option, + id: Option, bootnodes: Option>, discovery: Option, node_key: Option, diff --git a/parity/configuration.rs b/parity/configuration.rs index c4a54f747..37c699521 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -527,7 +527,7 @@ impl Configuration { Ok(ret) } - fn network_id(&self) -> Option { + fn network_id(&self) -> Option { self.args.flag_network_id.or(self.args.flag_networkid) } diff --git a/parity/run.rs b/parity/run.rs index 70c0b86f3..42a972000 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -70,7 +70,7 @@ pub struct RunCmd { pub http_conf: HttpConfiguration, pub ipc_conf: IpcConfiguration, pub net_conf: NetworkConfiguration, - pub network_id: Option, + pub network_id: Option, pub warp_sync: bool, pub acc_conf: AccountsConfig, pub gas_pricer: GasPricerConfig, @@ -194,7 +194,7 @@ pub fn execute(cmd: RunCmd, logger: Arc) -> Result<(), String> { let mut sync_config = SyncConfig::default(); sync_config.network_id = match cmd.network_id { Some(id) => id, - None => spec.network_id() as usize, + None => spec.network_id(), }; if spec.subprotocol_name().len() != 3 { warn!("Your chain specification's subprotocol length is not 3. Ignoring."); diff --git a/rpc/src/v1/tests/helpers/sync_provider.rs b/rpc/src/v1/tests/helpers/sync_provider.rs index 24be33417..8800d926a 100644 --- a/rpc/src/v1/tests/helpers/sync_provider.rs +++ b/rpc/src/v1/tests/helpers/sync_provider.rs @@ -23,7 +23,7 @@ use ethsync::{SyncProvider, SyncStatus, SyncState, PeerInfo, TransactionStats}; /// TestSyncProvider config. pub struct Config { /// Protocol version. - pub network_id: usize, + pub network_id: u64, /// Number of peers. pub num_peers: usize, } diff --git a/sync/src/api.rs b/sync/src/api.rs index cdab0983a..5613b77ff 100644 --- a/sync/src/api.rs +++ b/sync/src/api.rs @@ -44,7 +44,7 @@ pub struct SyncConfig { /// Enable ancient block download. pub download_old_blocks: bool, /// Network ID - pub network_id: usize, + pub network_id: u64, /// Main "eth" subprotocol name. pub subprotocol_name: [u8; 3], /// Fork block to check diff --git a/sync/src/chain.rs b/sync/src/chain.rs index bd312c9ee..2d53ad5ee 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -192,7 +192,7 @@ pub struct SyncStatus { /// Syncing protocol version. That's the maximum protocol version we connect to. pub protocol_version: u8, /// The underlying p2p network version. - pub network_id: usize, + pub network_id: u64, /// `BlockChain` height for the moment the sync started. pub start_block_number: BlockNumber, /// Last fully downloaded and imported block number (if any). @@ -273,7 +273,7 @@ struct PeerInfo { /// Peer chain genesis hash genesis: H256, /// Peer network id - network_id: usize, + network_id: u64, /// Peer best block hash latest_hash: H256, /// Peer total difficulty if known @@ -341,7 +341,7 @@ pub struct ChainSync { /// Last propagated block number last_sent_block_number: BlockNumber, /// Network ID - network_id: usize, + network_id: u64, /// Optional fork block to check fork_block: Option<(BlockNumber, H256)>, /// Snapshot downloader.