From f5ed31792fcd6daa252e748725c243c106edd55f Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 31 May 2016 20:54:02 +0200 Subject: [PATCH] fixed sync with client only --- Cargo.lock | 18 +----------------- Cargo.toml | 3 +-- miner/Cargo.toml | 24 ------------------------ miner/build.rs | 25 ------------------------- rpc/Cargo.toml | 3 +-- sync/Cargo.toml | 3 +-- sync/src/chain.rs | 10 +++------- sync/src/io.rs | 8 ++++---- sync/src/lib.rs | 6 ++---- sync/src/tests/helpers.rs | 1 - 10 files changed, 13 insertions(+), 88 deletions(-) delete mode 100644 miner/Cargo.toml delete mode 100644 miner/build.rs diff --git a/Cargo.lock b/Cargo.lock index cc2a8ef8c..291e90562 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,7 +17,6 @@ dependencies = [ "ethcore-rpc 1.2.0", "ethcore-signer 1.2.0", "ethcore-util 1.2.0", - "ethminer 1.2.0", "ethsync 1.2.0", "fdlimit 0.1.0", "hyper 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -255,6 +254,7 @@ dependencies = [ "lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "syntex 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -334,7 +334,6 @@ dependencies = [ "ethcore-devtools 1.2.0", "ethcore-util 1.2.0", "ethjson 0.1.0", - "ethminer 1.2.0", "ethsync 1.2.0", "json-ipc-server 0.1.0 (git+https://github.com/ethcore/json-ipc-server.git)", "jsonrpc-core 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -415,20 +414,6 @@ dependencies = [ "syntex 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "ethminer" -version = "1.2.0" -dependencies = [ - "clippy 0.0.69 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore 1.2.0", - "ethcore-util 1.2.0", - "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "ethsync" version = "1.2.0" @@ -437,7 +422,6 @@ dependencies = [ "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.2.0", "ethcore-util 1.2.0", - "ethminer 1.2.0", "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index d7813468a..ce8823bd2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,6 @@ clippy = { version = "0.0.69", optional = true} ethcore = { path = "ethcore" } ethcore-util = { path = "util" } ethsync = { path = "sync" } -ethminer = { path = "miner" } ethcore-devtools = { path = "devtools" } ethcore-rpc = { path = "rpc", optional = true } ethcore-signer = { path = "signer", optional = true } @@ -46,7 +45,7 @@ default-features = false default = ["rpc", "dapps", "ethcore-signer"] rpc = ["ethcore-rpc"] dapps = ["ethcore-dapps"] -dev = ["clippy", "ethcore/dev", "ethcore-util/dev", "ethsync/dev", "ethcore-rpc/dev", "ethminer/dev", +dev = ["clippy", "ethcore/dev", "ethcore-util/dev", "ethsync/dev", "ethcore-rpc/dev", "ethcore-dapps/dev", "ethcore-signer/dev"] travis-beta = ["ethcore/json-tests"] travis-nightly = ["ethcore/json-tests", "dev"] diff --git a/miner/Cargo.toml b/miner/Cargo.toml deleted file mode 100644 index a3a1c059f..000000000 --- a/miner/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -description = "Ethminer library" -homepage = "http://ethcore.io" -license = "GPL-3.0" -name = "ethminer" -version = "1.2.0" -authors = ["Ethcore "] -build = "build.rs" - -[build-dependencies] -rustc_version = "0.1" - -[dependencies] -ethcore-util = { path = "../util" } -ethcore = { path = "../ethcore" } -log = "0.3" -env_logger = "0.3" -rustc-serialize = "0.3" -rayon = "0.3.1" -clippy = { version = "0.0.69", optional = true} - -[features] -default = [] -dev = ["clippy"] diff --git a/miner/build.rs b/miner/build.rs deleted file mode 100644 index 41b9a1b3e..000000000 --- a/miner/build.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015, 2016 Ethcore (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -extern crate rustc_version; - -use rustc_version::{version_meta, Channel}; - -fn main() { - if let Channel::Nightly = version_meta().channel { - println!("cargo:rustc-cfg=nightly"); - } -} diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 61b51cf88..2dbefd7f4 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -18,7 +18,6 @@ ethcore-util = { path = "../util" } ethcore = { path = "../ethcore" } ethash = { path = "../ethash" } ethsync = { path = "../sync" } -ethminer = { path = "../miner" } ethjson = { path = "../json" } ethcore-devtools = { path = "../devtools" } rustc-serialize = "0.3" @@ -34,4 +33,4 @@ syntex = "^0.32.0" [features] default = ["serde_codegen"] nightly = ["serde_macros"] -dev = ["clippy", "ethcore/dev", "ethcore-util/dev", "ethsync/dev", "ethminer/dev"] +dev = ["clippy", "ethcore/dev", "ethcore-util/dev", "ethsync/dev"] diff --git a/sync/Cargo.toml b/sync/Cargo.toml index 7940aaa2d..1b80e23fc 100644 --- a/sync/Cargo.toml +++ b/sync/Cargo.toml @@ -11,7 +11,6 @@ authors = ["Ethcore , /// Network ID network_id: U256, - /// Miner - miner: Arc, } type RlpResponseResult = Result, PacketDecodeError>; impl ChainSync { /// Create a new instance of syncing strategy. - pub fn new(config: SyncConfig, miner: Arc, chain: &BlockChainClient) -> ChainSync { + pub fn new(config: SyncConfig, chain: &BlockChainClient) -> ChainSync { let chain = chain.chain_info(); let mut sync = ChainSync { state: SyncState::ChainHead, @@ -265,7 +263,6 @@ impl ChainSync { imported_this_round: None, _max_download_ahead_blocks: max(MAX_HEADERS_TO_REQUEST, config.max_download_ahead_blocks), network_id: config.network_id, - miner: miner, }; sync.reset(); sync @@ -903,7 +900,7 @@ impl ChainSync { nonce: chain.latest_nonce(a), balance: chain.latest_balance(a), }; - let _ = io.chain().import_transactions(transactions, fetch_account); + let _ = io.chain().import_transactions(transactions); Ok(()) } @@ -1288,7 +1285,6 @@ mod tests { use ethcore::header::*; use ethcore::client::*; use ethcore::spec::Spec; - use ethminer::{Miner, MinerService}; fn get_dummy_block(order: u32, parent_hash: H256) -> Bytes { let mut header = Header::new(); diff --git a/sync/src/io.rs b/sync/src/io.rs index 49cccd7ca..53a546e1c 100644 --- a/sync/src/io.rs +++ b/sync/src/io.rs @@ -14,10 +14,10 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use ethcore::client::MiningClient; use util::{NetworkContext, PeerId, PacketId,}; use util::error::UtilError; use ethcore::service::SyncMessage; +use ethcore::client::BlockChainClient; /// IO interface for the syning handler. /// Provides peer connection management and an interface to the blockchain client. @@ -32,7 +32,7 @@ pub trait SyncIo { /// Send a packet to a peer. fn send(&mut self, peer_id: PeerId, packet_id: PacketId, data: Vec) -> Result<(), UtilError>; /// Get the blockchain - fn chain(&self) -> &MiningClient; + fn chain(&self) -> &BlockChainClient; /// Returns peer client identifier string fn peer_info(&self, peer_id: PeerId) -> String { peer_id.to_string() @@ -46,12 +46,12 @@ pub trait SyncIo { /// Wraps `NetworkContext` and the blockchain client pub struct NetSyncIo<'s, 'h> where 'h: 's { network: &'s NetworkContext<'h, SyncMessage>, - chain: &'s MiningClient + chain: &'s BlockChainClient } impl<'s, 'h> NetSyncIo<'s, 'h> { /// Creates a new instance from the `NetworkContext` and the blockchain client reference. - pub fn new(network: &'s NetworkContext<'h, SyncMessage>, chain: &'s MiningClient) -> NetSyncIo<'s, 'h> { + pub fn new(network: &'s NetworkContext<'h, SyncMessage>, chain: &'s BlockChainClient) -> NetSyncIo<'s, 'h> { NetSyncIo { network: network, chain: chain, diff --git a/sync/src/lib.rs b/sync/src/lib.rs index 6b72a24fc..9fa6501a2 100644 --- a/sync/src/lib.rs +++ b/sync/src/lib.rs @@ -55,7 +55,6 @@ extern crate log; #[macro_use] extern crate ethcore_util as util; extern crate ethcore; -extern crate ethminer; extern crate env_logger; extern crate time; extern crate rand; @@ -69,7 +68,6 @@ use util::TimerToken; use util::{U256, ONE_U256}; use ethcore::client::Client; use ethcore::service::SyncMessage; -use ethminer::Miner; use io::NetSyncIo; use chain::ChainSync; @@ -115,8 +113,8 @@ pub use self::chain::{SyncStatus, SyncState}; impl EthSync { /// Creates and register protocol with the network service - pub fn register(service: &mut NetworkService, config: SyncConfig, chain: Arc, miner: Arc) -> Arc { - let sync = ChainSync::new(config, miner, chain.deref()); + pub fn register(service: &mut NetworkService, config: SyncConfig, chain: Arc) -> Arc { + let sync = ChainSync::new(config, chain.deref()); let sync = Arc::new(EthSync { chain: chain, sync: RwLock::new(sync), diff --git a/sync/src/tests/helpers.rs b/sync/src/tests/helpers.rs index 70ddb78db..c2e0e2d04 100644 --- a/sync/src/tests/helpers.rs +++ b/sync/src/tests/helpers.rs @@ -19,7 +19,6 @@ use ethcore::client::{TestBlockChainClient, BlockChainClient}; use ethcore::spec::Spec; use io::SyncIo; use chain::ChainSync; -use ethminer::Miner; use ::SyncConfig; pub struct TestIo<'p> {