Merge branch 'master' into upload-crates

This commit is contained in:
Robert Habermeier
2017-11-17 16:42:41 +01:00
239 changed files with 9671 additions and 16026 deletions

View File

@@ -16,7 +16,6 @@ memorydb = { path = "../../util/memorydb" }
patricia-trie = { path = "../../util/patricia_trie" }
ethcore-network = { path = "../../util/network" }
ethcore-io = { path = "../../util/io" }
ethcore-devtools = { path = "../../devtools" }
evm = { path = "../evm" }
heapsize = "0.4"
vm = { path = "../vm" }
@@ -39,5 +38,8 @@ kvdb-rocksdb = { path = "../../util/kvdb-rocksdb" }
kvdb-memorydb = { path = "../../util/kvdb-memorydb" }
memory-cache = { path = "../../util/memory_cache" }
[dev-dependencies]
tempdir = "0.3"
[features]
default = []

View File

@@ -120,7 +120,6 @@ impl<T: ChainDataFetcher> IoHandler<ClientIoMessage> for ImportBlocks<T> {
#[cfg(test)]
mod tests {
use super::Service;
use devtools::RandomTempPath;
use ethcore::spec::Spec;
use std::sync::Arc;
@@ -128,13 +127,14 @@ mod tests {
use client::fetch;
use time::Duration;
use parking_lot::Mutex;
use tempdir::TempDir;
#[test]
fn it_works() {
let tempdir = TempDir::new("").unwrap();
let spec = Spec::new_test();
let temp_path = RandomTempPath::new();
let cache = Arc::new(Mutex::new(Cache::new(Default::default(), Duration::hours(6))));
Service::start(Default::default(), &spec, fetch::unavailable(), temp_path.as_path(), cache).unwrap();
Service::start(Default::default(), &spec, fetch::unavailable(), tempdir.path(), cache).unwrap();
}
}

View File

@@ -84,4 +84,4 @@ extern crate kvdb_rocksdb;
extern crate memory_cache;
#[cfg(test)]
extern crate ethcore_devtools as devtools;
extern crate tempdir;

View File

@@ -17,10 +17,8 @@
//! Defines error types and levels of punishment to use upon
//! encountering.
use rlp::DecoderError;
use network::NetworkError;
use std::fmt;
use {rlp, network};
/// Levels of punishment.
///
@@ -41,9 +39,9 @@ pub enum Punishment {
#[derive(Debug)]
pub enum Error {
/// An RLP decoding error.
Rlp(DecoderError),
Rlp(rlp::DecoderError),
/// A network error.
Network(NetworkError),
Network(network::Error),
/// Out of credits.
NoCredits,
/// Unrecognized packet code.
@@ -92,14 +90,14 @@ impl Error {
}
}
impl From<DecoderError> for Error {
fn from(err: DecoderError) -> Self {
impl From<rlp::DecoderError> for Error {
fn from(err: rlp::DecoderError) -> Self {
Error::Rlp(err)
}
}
impl From<NetworkError> for Error {
fn from(err: NetworkError) -> Self {
impl From<network::Error> for Error {
fn from(err: network::Error) -> Self {
Error::Network(err)
}
}

View File

@@ -264,8 +264,9 @@ mod tests {
#[test]
fn file_store() {
let path = ::devtools::RandomTempPath::new();
let store = FileStore(path.as_path().clone());
let tempdir = ::tempdir::TempDir::new("").unwrap();
let path = tempdir.path().join("file");
let store = FileStore(path);
let mut samples = store.load();
assert!(samples.is_empty());