Adding documentation and ditching EthMiner

This commit is contained in:
Tomasz Drwięga
2016-03-09 14:26:28 +01:00
parent 9d664336b5
commit 363de973c9
7 changed files with 74 additions and 44 deletions

View File

@@ -38,7 +38,7 @@ use range_collection::{RangeCollection, ToUsize, FromUsize};
use ethcore::error::*;
use ethcore::transaction::SignedTransaction;
use ethcore::block::Block;
use ethminer::{EthMiner, MinerService};
use ethminer::{Miner, MinerService};
use io::SyncIo;
use time;
use super::SyncConfig;
@@ -212,14 +212,14 @@ pub struct ChainSync {
/// Network ID
network_id: U256,
/// Miner
miner: Arc<EthMiner>,
miner: Arc<Miner>,
}
type RlpResponseResult = Result<Option<(PacketId, RlpStream)>, PacketDecodeError>;
impl ChainSync {
/// Create a new instance of syncing strategy.
pub fn new(config: SyncConfig, miner: Arc<EthMiner>) -> ChainSync {
pub fn new(config: SyncConfig, miner: Arc<Miner>) -> ChainSync {
ChainSync {
state: SyncState::NotSynced,
starting_block: 0,
@@ -1285,7 +1285,7 @@ mod tests {
use super::{PeerInfo, PeerAsking};
use ethcore::header::*;
use ethcore::client::*;
use ethminer::{EthMiner, MinerService};
use ethminer::{Miner, MinerService};
fn get_dummy_block(order: u32, parent_hash: H256) -> Bytes {
let mut header = Header::new();
@@ -1395,7 +1395,7 @@ mod tests {
}
fn dummy_sync_with_peer(peer_latest_hash: H256) -> ChainSync {
let mut sync = ChainSync::new(SyncConfig::default(), EthMiner::new());
let mut sync = ChainSync::new(SyncConfig::default(), Miner::new());
sync.peers.insert(0,
PeerInfo {
protocol_version: 0,

View File

@@ -65,7 +65,7 @@ use util::TimerToken;
use util::{U256, ONE_U256};
use ethcore::client::Client;
use ethcore::service::SyncMessage;
use ethminer::EthMiner;
use ethminer::Miner;
use io::NetSyncIo;
use chain::ChainSync;
@@ -105,7 +105,7 @@ pub use self::chain::{SyncStatus, SyncState};
impl EthSync {
/// Creates and register protocol with the network service
pub fn register(service: &mut NetworkService<SyncMessage>, config: SyncConfig, chain: Arc<Client>, miner: Arc<EthMiner>) -> Arc<EthSync> {
pub fn register(service: &mut NetworkService<SyncMessage>, config: SyncConfig, chain: Arc<Client>, miner: Arc<Miner>) -> Arc<EthSync> {
let sync = Arc::new(EthSync {
chain: chain,
sync: RwLock::new(ChainSync::new(config, miner)),

View File

@@ -19,7 +19,7 @@ use ethcore::client::{BlockChainClient, BlockStatus, TreeRoute, BlockChainInfo,
use ethcore::header::{Header as BlockHeader, BlockNumber};
use ethcore::block::*;
use ethcore::error::*;
use ethminer::EthMiner;
use ethminer::Miner;
use io::SyncIo;
use chain::ChainSync;
use ::SyncConfig;
@@ -392,7 +392,7 @@ impl TestNet {
for _ in 0..n {
net.peers.push(TestPeer {
chain: TestBlockChainClient::new(),
sync: ChainSync::new(SyncConfig::default(), EthMiner::new()),
sync: ChainSync::new(SyncConfig::default(), Miner::new()),
queue: VecDeque::new(),
});
}