Merge branch 'master' of github.com:ethcore/parity into discovery

This commit is contained in:
arkpar
2016-02-19 13:39:43 +01:00
32 changed files with 409 additions and 324 deletions

View File

@@ -10,8 +10,12 @@ authors = ["Ethcore <admin@ethcore.io"]
[dependencies]
ethcore-util = { path = "../util" }
ethcore = { path = ".." }
clippy = "0.0.41"
clippy = { version = "0.0.42", optional = true }
log = "0.3"
env_logger = "0.3"
time = "0.1.34"
rand = "0.3.13"
[features]
default = []
dev = ["clippy", "ethcore/dev", "ethcore-util/dev"]

View File

@@ -15,9 +15,8 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
#![warn(missing_docs)]
#![feature(plugin)]
#![feature(augmented_assignments)]
#![plugin(clippy)]
#![cfg_attr(feature="dev", feature(plugin))]
#![cfg_attr(feature="dev", plugin(clippy))]
// Keeps consistency (all lines with `.clone()`) and helpful when changing ref to non-ref.
#![allow(clone_on_copy)]
@@ -59,7 +58,7 @@ use std::ops::*;
use std::sync::*;
use ethcore::client::Client;
use util::network::{NetworkProtocolHandler, NetworkService, NetworkContext, PeerId};
use util::io::TimerToken;
use util::TimerToken;
use chain::ChainSync;
use ethcore::service::SyncMessage;
use io::NetSyncIo;

View File

@@ -213,7 +213,10 @@ impl BlockChainClient for TestBlockChainClient {
}
let len = self.numbers.read().unwrap().len();
if number == len {
*self.difficulty.write().unwrap().deref_mut() += header.difficulty;
{
let mut difficulty = self.difficulty.write().unwrap();
*difficulty.deref_mut() = *difficulty.deref() + header.difficulty;
}
mem::replace(self.last_hash.write().unwrap().deref_mut(), h.clone());
self.blocks.write().unwrap().insert(h.clone(), b);
self.numbers.write().unwrap().insert(number, h.clone());