network_id -> u64

This commit is contained in:
Gav Wood 2016-12-05 06:54:31 -08:00
parent 2911c549e3
commit 43ec3d8f79
No known key found for this signature in database
GPG Key ID: C49C1ACA1CC9B252
6 changed files with 11 additions and 11 deletions

View File

@ -48,7 +48,7 @@ usage! {
flag_testnet: bool, flag_testnet: bool,
flag_import_geth_keys: bool, flag_import_geth_keys: bool,
flag_datadir: Option<String>, flag_datadir: Option<String>,
flag_networkid: Option<usize>, flag_networkid: Option<u64>,
flag_peers: Option<u16>, flag_peers: Option<u16>,
flag_nodekey: Option<String>, flag_nodekey: Option<String>,
flag_nodiscover: bool, flag_nodiscover: bool,
@ -122,7 +122,7 @@ usage! {
or |c: &Config| otry!(c.network).nat.clone(), or |c: &Config| otry!(c.network).nat.clone(),
flag_allow_ips: String = "all", flag_allow_ips: String = "all",
or |c: &Config| otry!(c.network).allow_ips.clone(), or |c: &Config| otry!(c.network).allow_ips.clone(),
flag_network_id: Option<usize> = None, flag_network_id: Option<u64> = None,
or |c: &Config| otry!(c.network).id.clone().map(Some), or |c: &Config| otry!(c.network).id.clone().map(Some),
flag_bootnodes: Option<String> = None, flag_bootnodes: Option<String> = None,
or |c: &Config| otry!(c.network).bootnodes.clone().map(|vec| Some(vec.join(","))), or |c: &Config| otry!(c.network).bootnodes.clone().map(|vec| Some(vec.join(","))),
@ -328,7 +328,7 @@ struct Network {
max_pending_peers: Option<u16>, max_pending_peers: Option<u16>,
nat: Option<String>, nat: Option<String>,
allow_ips: Option<String>, allow_ips: Option<String>,
id: Option<usize>, id: Option<u64>,
bootnodes: Option<Vec<String>>, bootnodes: Option<Vec<String>>,
discovery: Option<bool>, discovery: Option<bool>,
node_key: Option<String>, node_key: Option<String>,

View File

@ -527,7 +527,7 @@ impl Configuration {
Ok(ret) Ok(ret)
} }
fn network_id(&self) -> Option<usize> { fn network_id(&self) -> Option<u64> {
self.args.flag_network_id.or(self.args.flag_networkid) self.args.flag_network_id.or(self.args.flag_networkid)
} }

View File

@ -70,7 +70,7 @@ pub struct RunCmd {
pub http_conf: HttpConfiguration, pub http_conf: HttpConfiguration,
pub ipc_conf: IpcConfiguration, pub ipc_conf: IpcConfiguration,
pub net_conf: NetworkConfiguration, pub net_conf: NetworkConfiguration,
pub network_id: Option<usize>, pub network_id: Option<u64>,
pub warp_sync: bool, pub warp_sync: bool,
pub acc_conf: AccountsConfig, pub acc_conf: AccountsConfig,
pub gas_pricer: GasPricerConfig, pub gas_pricer: GasPricerConfig,
@ -194,7 +194,7 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<(), String> {
let mut sync_config = SyncConfig::default(); let mut sync_config = SyncConfig::default();
sync_config.network_id = match cmd.network_id { sync_config.network_id = match cmd.network_id {
Some(id) => id, Some(id) => id,
None => spec.network_id() as usize, None => spec.network_id(),
}; };
if spec.subprotocol_name().len() != 3 { if spec.subprotocol_name().len() != 3 {
warn!("Your chain specification's subprotocol length is not 3. Ignoring."); warn!("Your chain specification's subprotocol length is not 3. Ignoring.");

View File

@ -23,7 +23,7 @@ use ethsync::{SyncProvider, SyncStatus, SyncState, PeerInfo, TransactionStats};
/// TestSyncProvider config. /// TestSyncProvider config.
pub struct Config { pub struct Config {
/// Protocol version. /// Protocol version.
pub network_id: usize, pub network_id: u64,
/// Number of peers. /// Number of peers.
pub num_peers: usize, pub num_peers: usize,
} }

View File

@ -44,7 +44,7 @@ pub struct SyncConfig {
/// Enable ancient block download. /// Enable ancient block download.
pub download_old_blocks: bool, pub download_old_blocks: bool,
/// Network ID /// Network ID
pub network_id: usize, pub network_id: u64,
/// Main "eth" subprotocol name. /// Main "eth" subprotocol name.
pub subprotocol_name: [u8; 3], pub subprotocol_name: [u8; 3],
/// Fork block to check /// Fork block to check

View File

@ -192,7 +192,7 @@ pub struct SyncStatus {
/// Syncing protocol version. That's the maximum protocol version we connect to. /// Syncing protocol version. That's the maximum protocol version we connect to.
pub protocol_version: u8, pub protocol_version: u8,
/// The underlying p2p network version. /// The underlying p2p network version.
pub network_id: usize, pub network_id: u64,
/// `BlockChain` height for the moment the sync started. /// `BlockChain` height for the moment the sync started.
pub start_block_number: BlockNumber, pub start_block_number: BlockNumber,
/// Last fully downloaded and imported block number (if any). /// Last fully downloaded and imported block number (if any).
@ -273,7 +273,7 @@ struct PeerInfo {
/// Peer chain genesis hash /// Peer chain genesis hash
genesis: H256, genesis: H256,
/// Peer network id /// Peer network id
network_id: usize, network_id: u64,
/// Peer best block hash /// Peer best block hash
latest_hash: H256, latest_hash: H256,
/// Peer total difficulty if known /// Peer total difficulty if known
@ -341,7 +341,7 @@ pub struct ChainSync {
/// Last propagated block number /// Last propagated block number
last_sent_block_number: BlockNumber, last_sent_block_number: BlockNumber,
/// Network ID /// Network ID
network_id: usize, network_id: u64,
/// Optional fork block to check /// Optional fork block to check
fork_block: Option<(BlockNumber, H256)>, fork_block: Option<(BlockNumber, H256)>,
/// Snapshot downloader. /// Snapshot downloader.