Separate migrations from util (#6690)
* separate migration from util and make its dependencies into libs: * snappy * kvdb * error * common * renamed common -> macros * util error does not depend on snappy module * ethsync does not depend on util nor ethcore_error * nibbleslice and nibblevec merged with patricia_trie crate * removed unused dependencies from util * util journaldb traits does not need to be public * util_error * fixed ethcore compile error * ignore .swo files * Update chain.rs
This commit is contained in:
@@ -21,7 +21,6 @@ use hash::{keccak, KECCAK_NULL_RLP, KECCAK_EMPTY_LIST_RLP};
|
||||
use heapsize::HeapSizeOf;
|
||||
use bigint::hash::H256;
|
||||
use triehash::ordered_trie_root;
|
||||
use util::*;
|
||||
use bytes::Bytes;
|
||||
use rlp::*;
|
||||
use network::NetworkError;
|
||||
@@ -406,7 +405,7 @@ impl BlockCollection {
|
||||
}
|
||||
}
|
||||
|
||||
fn insert_header(&mut self, header: Bytes) -> Result<H256, UtilError> {
|
||||
fn insert_header(&mut self, header: Bytes) -> Result<H256, DecoderError> {
|
||||
let info: BlockHeader = UntrustedRlp::new(&header).as_val()?;
|
||||
let hash = info.hash();
|
||||
if self.blocks.contains_key(&hash) {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
///
|
||||
/// `BlockChain` synchronization strategy.
|
||||
/// Syncs to peers and keeps up to date.
|
||||
/// This implementation uses ethereum protocol v63
|
||||
@@ -2230,19 +2229,18 @@ fn accepts_service_transaction(client_id: &str) -> bool {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::collections::{HashSet, VecDeque};
|
||||
use {ethkey, Address};
|
||||
use network::PeerId;
|
||||
use tests::helpers::*;
|
||||
use tests::snapshot::TestSnapshotService;
|
||||
use bigint::prelude::U256;
|
||||
use bigint::hash::H256;
|
||||
use util::Address;
|
||||
use parking_lot::RwLock;
|
||||
use bytes::Bytes;
|
||||
use rlp::{Rlp, RlpStream, UntrustedRlp};
|
||||
use super::*;
|
||||
use ::SyncConfig;
|
||||
use super::{PeerInfo, PeerAsking};
|
||||
use ethkey;
|
||||
use ethcore::header::*;
|
||||
use ethcore::client::{BlockChainClient, EachBlockWith, TestBlockChainClient};
|
||||
use ethcore::transaction::UnverifiedTransaction;
|
||||
|
||||
@@ -42,6 +42,7 @@ extern crate rlp;
|
||||
extern crate ipnetwork;
|
||||
extern crate hash;
|
||||
extern crate triehash;
|
||||
extern crate kvdb;
|
||||
|
||||
extern crate ethcore_light as light;
|
||||
|
||||
@@ -49,9 +50,9 @@ extern crate ethcore_light as light;
|
||||
#[cfg(test)] extern crate ethkey;
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate macros;
|
||||
#[macro_use]
|
||||
extern crate ethcore_util as util;
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate heapsize;
|
||||
#[macro_use]
|
||||
@@ -82,6 +83,9 @@ pub use api::*;
|
||||
pub use chain::{SyncStatus, SyncState};
|
||||
pub use network::{is_valid_node_url, NonReservedPeerMode, NetworkError, ConnectionFilter, ConnectionDirection};
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) type Address = bigint::hash::H160;
|
||||
|
||||
/// IPC interfaces
|
||||
#[cfg(feature="ipc")]
|
||||
pub mod remote {
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
use std::sync::Arc;
|
||||
use hash::keccak;
|
||||
use bigint::prelude::U256;
|
||||
use util::*;
|
||||
use io::{IoHandler, IoContext, IoChannel};
|
||||
use ethcore::client::{BlockChainClient, Client};
|
||||
use ethcore::service::ClientIoMessage;
|
||||
@@ -27,7 +26,7 @@ use ethcore::transaction::*;
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
use ethkey::{KeyPair, Secret};
|
||||
use super::helpers::*;
|
||||
use SyncConfig;
|
||||
use {SyncConfig, Address};
|
||||
|
||||
struct TestIoHandler {
|
||||
client: Arc<Client>,
|
||||
|
||||
@@ -291,7 +291,7 @@ impl TestNet<EthPeer<EthcoreClient>> {
|
||||
let client = EthcoreClient::new(
|
||||
ClientConfig::default(),
|
||||
&spec,
|
||||
Arc::new(::util::kvdb::in_memory(::ethcore::db::NUM_COLUMNS.unwrap_or(0))),
|
||||
Arc::new(::kvdb::in_memory(::ethcore::db::NUM_COLUMNS.unwrap_or(0))),
|
||||
Arc::new(Miner::with_spec_and_accounts(&spec, accounts)),
|
||||
IoChannel::disconnected(),
|
||||
).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user