Merge branch 'master' into ethminer_crate

Conflicts:
	parity/main.rs
	rpc/src/v1/impls/eth.rs
	sync/src/lib.rs
This commit is contained in:
Tomasz Drwięga 2016-03-11 10:23:33 +01:00
commit 5b204a5ff5
4 changed files with 17 additions and 16 deletions

View File

@ -50,7 +50,7 @@ use ethcore::spec::*;
use ethcore::client::*;
use ethcore::service::{ClientService, NetSyncMessage};
use ethcore::ethereum;
use ethsync::{EthSync, SyncConfig, SyncStatusProvider};
use ethsync::{EthSync, SyncConfig, SyncProvider};
use ethminer::{Miner, MinerService};
use docopt::Docopt;
use daemonize::Daemonize;
@ -81,7 +81,7 @@ Protocol Options:
or olympic, frontier, homestead, mainnet, morden, or testnet [default: homestead].
--testnet Equivalent to --chain testnet (geth-compatible).
--networkid INDEX Override the network identifier from the chain we are on.
--archive Client should not prune the state/storage trie.
--pruning Client should prune the state/storage trie.
-d --datadir PATH Specify the database & configuration directory path [default: $HOME/.parity]
--keys-path PATH Specify the path for JSON key files to be found [default: $HOME/.web3/keys]
--identity NAME Specify your node's name.
@ -143,7 +143,7 @@ struct Args {
flag_identity: String,
flag_cache: Option<usize>,
flag_keys_path: String,
flag_archive: bool,
flag_pruning: bool,
flag_no_bootstrap: bool,
flag_listen_address: String,
flag_public_address: Option<String>,
@ -364,7 +364,7 @@ impl Configuration {
client_config.blockchain.max_cache_size = self.args.flag_cache_max_size;
}
}
client_config.prefer_journal = !self.args.flag_archive;
client_config.prefer_journal = self.args.flag_pruning;
client_config.name = self.args.flag_identity.clone();
client_config.queue.max_mem_use = self.args.flag_queue_max_size;
client_config

View File

@ -18,7 +18,7 @@
use std::collections::HashMap;
use std::sync::{Arc, Weak, Mutex, RwLock};
use std::ops::Deref;
use ethsync::{SyncStatusProvider, SyncState};
use ethsync::{SyncProvider, SyncState};
use ethminer::{MinerService};
use jsonrpc_core::*;
use util::numbers::*;
@ -36,7 +36,7 @@ use v1::helpers::{PollFilter, PollManager};
/// Eth rpc implementation.
pub struct EthClient<C, S, M>
where C: BlockChainClient,
S: SyncStatusProvider,
S: SyncProvider,
M: MinerService {
client: Weak<C>,
sync: Weak<S>,
@ -44,8 +44,10 @@ pub struct EthClient<C, S, M>
hashrates: RwLock<HashMap<H256, u64>>,
}
impl<C, S, M> EthClient<C, S, M> where C: BlockChainClient, S: SyncStatusProvider, M: MinerService {
impl<C, S, M> EthClient<C, S, M>
where C: BlockChainClient,
S: SyncProvider,
M: MinerService {
/// Creates new EthClient.
pub fn new(client: &Arc<C>, sync: &Arc<S>, miner: &Arc<M>) -> Self {
EthClient {
@ -104,7 +106,7 @@ impl<C, S, M> EthClient<C, S, M> where C: BlockChainClient, S: SyncStatusProvide
impl<C, S, M> Eth for EthClient<C, S, M>
where C: BlockChainClient + 'static,
S: SyncStatusProvider + 'static,
S: SyncProvider + 'static,
M: MinerService + 'static {
fn protocol_version(&self, params: Params) -> Result<Value, Error> {
match params {

View File

@ -17,15 +17,15 @@
//! Net rpc implementation.
use std::sync::{Arc, Weak};
use jsonrpc_core::*;
use ethsync::SyncStatusProvider;
use ethsync::SyncProvider;
use v1::traits::Net;
/// Net rpc implementation.
pub struct NetClient<S> where S: SyncStatusProvider {
pub struct NetClient<S> where S: SyncProvider {
sync: Weak<S>
}
impl<S> NetClient<S> where S: SyncStatusProvider {
impl<S> NetClient<S> where S: SyncProvider {
/// Creates new NetClient.
pub fn new(sync: &Arc<S>) -> Self {
NetClient {
@ -34,7 +34,7 @@ impl<S> NetClient<S> where S: SyncStatusProvider {
}
}
impl<S> Net for NetClient<S> where S: SyncStatusProvider + 'static {
impl<S> Net for NetClient<S> where S: SyncProvider + 'static {
fn version(&self, _: Params) -> Result<Value, Error> {
Ok(Value::U64(take_weak!(self.sync).status().protocol_version as u64))
}

View File

@ -97,7 +97,7 @@ impl Default for SyncConfig {
}
/// Current sync status
pub trait SyncStatusProvider: Send + Sync {
pub trait SyncProvider: Send + Sync {
/// Get sync status
fn status(&self) -> SyncStatus;
}
@ -132,10 +132,9 @@ impl EthSync {
pub fn restart(&mut self, io: &mut NetworkContext<SyncMessage>) {
self.sync.write().unwrap().restart(&mut NetSyncIo::new(io, self.chain.deref()));
}
}
impl SyncStatusProvider for EthSync {
impl SyncProvider for EthSync {
/// Get sync status
fn status(&self) -> SyncStatus {
self.sync.read().unwrap().status()