Skip to content

Commit

Permalink
Merge pull request #4 from nervosnetwork/zhangsoledad/remove_alias
Browse files Browse the repository at this point in the history
refactor: remove redundant alias
  • Loading branch information
zhangsoledad authored Nov 20, 2018
2 parents a42b2fa + 2b25aa5 commit a3a16ae
Show file tree
Hide file tree
Showing 79 changed files with 381 additions and 378 deletions.
38 changes: 19 additions & 19 deletions chain/src/chain.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
use bigint::{H256, U256};
use chain_spec::consensus::Consensus;
use channel::{self, Receiver, Sender};
use ckb_chain_spec::consensus::Consensus;
use ckb_core::block::Block;
use ckb_core::extras::BlockExt;
use ckb_core::header::BlockNumber;
use ckb_core::service::{Request, DEFAULT_CHANNEL_SIZE};
use ckb_db::batch::Batch;
use ckb_notify::{ForkBlocks, NotifyController, NotifyService};
use core::block::Block;
use core::extras::BlockExt;
use core::header::BlockNumber;
use core::service::{Request, DEFAULT_CHANNEL_SIZE};
use db::batch::Batch;
use ckb_shared::error::SharedError;
use ckb_shared::index::ChainIndex;
use ckb_shared::shared::{ChainProvider, Shared, TipHeader};
use ckb_time::now_ms;
use ckb_verification::{BlockVerifier, Verifier};
use error::ProcessBlockError;
use log;
use shared::error::SharedError;
use shared::index::ChainIndex;
use shared::shared::{ChainProvider, Shared, TipHeader};
use std::cmp;
use std::sync::Arc;
use std::thread::{self, JoinHandle};
use time::now_ms;
use verification::{BlockVerifier, Verifier};

pub struct ChainService<CI> {
shared: Shared<CI>,
Expand Down Expand Up @@ -380,16 +380,16 @@ impl<CI: ChainIndex + 'static> ChainBuilder<CI> {
pub mod test {
use super::*;
use bigint::U256;
use core::block::BlockBuilder;
use core::cell::CellProvider;
use core::header::{Header, HeaderBuilder};
use core::transaction::{
use ckb_core::block::BlockBuilder;
use ckb_core::cell::CellProvider;
use ckb_core::header::{Header, HeaderBuilder};
use ckb_core::transaction::{
CellInput, CellOutput, OutPoint, ProposalShortId, Transaction, TransactionBuilder,
};
use core::uncle::UncleBlock;
use db::memorydb::MemoryKeyValueDB;
use shared::shared::SharedBuilder;
use shared::store::ChainKVStore;
use ckb_core::uncle::UncleBlock;
use ckb_db::memorydb::MemoryKeyValueDB;
use ckb_shared::shared::SharedBuilder;
use ckb_shared::store::ChainKVStore;

fn start_chain(
consensus: Option<Consensus>,
Expand Down
4 changes: 2 additions & 2 deletions chain/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use shared::error::SharedError;
use verification::Error as VerifyError;
use ckb_shared::error::SharedError;
use ckb_verification::Error as VerifyError;

#[derive(Debug, PartialEq, Clone, Eq)]
pub enum ProcessBlockError {
Expand Down
12 changes: 6 additions & 6 deletions chain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
//! implement `ChainProvider`

extern crate bigint;
extern crate ckb_chain_spec as chain_spec;
extern crate ckb_core as core;
extern crate ckb_db as db;
extern crate ckb_chain_spec;
extern crate ckb_core;
extern crate ckb_db;
extern crate ckb_notify;
extern crate ckb_shared as shared;
extern crate ckb_time as time;
extern crate ckb_verification as verification;
extern crate ckb_shared;
extern crate ckb_time;
extern crate ckb_verification;
#[macro_use]
extern crate log;
#[macro_use]
Expand Down
2 changes: 1 addition & 1 deletion db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! which provides key-value store interface

extern crate bincode;
extern crate ckb_util as util;
extern crate ckb_util;
extern crate fnv;
extern crate rocksdb;

Expand Down
2 changes: 1 addition & 1 deletion db/src/memorydb.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use batch::{Batch, Col, Operation};
use ckb_util::RwLock;
use fnv::FnvHashMap;
use kvdb::{ErrorKind, KeyValueDB, Result};
use std::ops::Range;
use util::RwLock;

pub type MemoryKey = Vec<u8>;
pub type MemoryValue = Vec<u8>;
Expand Down
12 changes: 6 additions & 6 deletions miner/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
extern crate bigint;
extern crate ckb_chain as chain;
extern crate ckb_core as core;
extern crate ckb_network as network;
extern crate ckb_chain;
extern crate ckb_core;
extern crate ckb_network;
extern crate ckb_notify;
extern crate ckb_protocol;
extern crate ckb_rpc as rpc;
extern crate ckb_shared as shared;
extern crate ckb_rpc;
extern crate ckb_shared;
#[macro_use]
extern crate crossbeam_channel as channel;
#[macro_use]
extern crate log;
extern crate ckb_sync as sync;
extern crate ckb_sync;
extern crate flatbuffers;
extern crate rand;
#[macro_use]
Expand Down
18 changes: 9 additions & 9 deletions miner/src/miner.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
use super::Config;
use chain::chain::ChainController;
use channel::Receiver;
use ckb_chain::chain::ChainController;
use ckb_core::block::{Block, BlockBuilder};
use ckb_core::header::{RawHeader, Seal};
use ckb_core::BlockNumber;
use ckb_network::NetworkService;
use ckb_notify::{MsgNewTip, MsgNewTransaction, NotifyController, MINER_SUBSCRIBER};
use ckb_pow::PowEngine;
use ckb_protocol::RelayMessage;
use core::block::{Block, BlockBuilder};
use core::header::{RawHeader, Seal};
use core::BlockNumber;
use ckb_rpc::{BlockTemplate, RpcController};
use ckb_shared::index::ChainIndex;
use ckb_shared::shared::Shared;
use ckb_sync::RELAY_PROTOCOL_ID;
use flatbuffers::FlatBufferBuilder;
use network::NetworkService;
use rand::{thread_rng, Rng};
use rpc::{BlockTemplate, RpcController};
use shared::index::ChainIndex;
use shared::shared::Shared;
use std::collections::HashSet;
use std::sync::Arc;
use std::thread::{self, JoinHandle};
use sync::RELAY_PROTOCOL_ID;

pub struct MinerService {
config: Config,
Expand Down
2 changes: 1 addition & 1 deletion network/src/ckb_protocol_handler.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use super::errors::{Error, ErrorKind};
use super::{Network, SessionInfo, Timer};
use super::{PeerIndex, ProtocolId, TimerToken};
use ckb_util::Mutex;
use std::sync::Arc;
use std::time::Duration;
use util::Mutex;

#[derive(Clone, Debug)]
pub enum Severity<'a> {
Expand Down
2 changes: 1 addition & 1 deletion network/src/discovery_service.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]

use super::Network;
use ckb_util::Mutex;
use fnv::FnvHashMap;
use futures::future::{self, Future};
use futures::Stream;
Expand All @@ -24,7 +25,6 @@ use tokio::io::{AsyncRead, AsyncWrite};
use tokio::timer::Interval;
use tokio::timer::Timeout;
use transport::TransportOutput;
use util::Mutex;

pub struct DiscoveryService {
timeout: Duration,
Expand Down
2 changes: 1 addition & 1 deletion network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern crate log;
extern crate fnv;
#[macro_use]
extern crate serde_derive;
extern crate ckb_util as util;
extern crate ckb_util;

mod ckb_protocol;
mod ckb_protocol_handler;
Expand Down
2 changes: 1 addition & 1 deletion network/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use ckb_protocol::{CKBProtocol, CKBProtocols};
use ckb_protocol_handler::CKBProtocolHandler;
use ckb_protocol_handler::DefaultCKBProtocolContext;
use ckb_service::CKBService;
use ckb_util::{Mutex, RwLock};
use discovery_service::DiscoveryService;
use futures::future::{self, select_all, Future};
use futures::sync::mpsc::UnboundedSender;
Expand Down Expand Up @@ -34,7 +35,6 @@ use std::usize;
use timer_service::TimerService;
use tokio::io::{AsyncRead, AsyncWrite};
use transport::{new_transport, TransportOutput};
use util::{Mutex, RwLock};

const WAIT_LOCK_TIMEOUT: u64 = 3;
const KBUCKETS_TIMEOUT: u64 = 600;
Expand Down
2 changes: 1 addition & 1 deletion network/src/network_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use super::{Error, ErrorKind, ProtocolId};
use ckb_protocol::CKBProtocol;
use ckb_protocol_handler::CKBProtocolHandler;
use ckb_protocol_handler::{CKBProtocolContext, DefaultCKBProtocolContext};
use ckb_util::RwLock;
use futures::future::Future;
use futures::sync::oneshot;
use libp2p::core::PeerId;
Expand All @@ -14,7 +15,6 @@ use std::io::{Error as IoError, ErrorKind as IoErrorKind};
use std::sync::Arc;
use std::thread;
use tokio::runtime::current_thread;
use util::RwLock;

pub struct NetworkService {
network: Arc<Network>,
Expand Down
2 changes: 1 addition & 1 deletion network/src/peers_registry.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::{Error, ErrorKind, PeerId, PeerIndex, ProtocolId};
use bytes::Bytes;
use ckb_util::{Mutex, RwLock};
use fnv::FnvHashMap;
use futures::sync::mpsc::UnboundedSender;
use libp2p::core::{Endpoint, Multiaddr, UniqueConnec};
Expand All @@ -9,7 +10,6 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::time::Duration;
use std::time::Instant;
use util::{Mutex, RwLock};

struct PeerConnections {
id_allocator: AtomicUsize,
Expand Down
2 changes: 1 addition & 1 deletion network/src/timer_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::Network;
use super::PeerId;
use super::{CKBProtocolHandler, ProtocolId, TimerToken};
use ckb_protocol_handler::DefaultCKBProtocolContext;
use ckb_util::Mutex;
use futures::future::{self, Future};
use futures::stream::FuturesUnordered;
use futures::Stream;
Expand All @@ -17,7 +18,6 @@ use tokio;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::timer::Interval;
use transport::TransportOutput;
use util::Mutex;

pub(crate) type Timer = (Arc<CKBProtocolHandler>, ProtocolId, TimerToken, Duration);

Expand Down
6 changes: 3 additions & 3 deletions notify/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]

extern crate ckb_core as core;
extern crate ckb_core;
#[macro_use]
extern crate crossbeam_channel as channel;
extern crate fnv;
Expand All @@ -12,8 +12,8 @@ use std::thread;
use std::thread::JoinHandle;

use channel::{Receiver, Sender};
use core::block::Block;
use core::service::Request;
use ckb_core::block::Block;
use ckb_core::service::Request;
use fnv::FnvHashMap;

pub const MINER_SUBSCRIBER: &str = "miner";
Expand Down
6 changes: 3 additions & 3 deletions pool/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern crate bigint;
extern crate ckb_chain_spec as chain_spec;
extern crate ckb_core as core;
extern crate ckb_chain_spec;
extern crate ckb_core;
extern crate ckb_notify;
extern crate ckb_shared;
extern crate ckb_verification;
Expand All @@ -19,7 +19,7 @@ extern crate ckb_chain;
#[cfg(test)]
extern crate ckb_db;
#[cfg(test)]
extern crate ckb_time as time;
extern crate ckb_time;
#[cfg(test)]
extern crate hash;

Expand Down
14 changes: 7 additions & 7 deletions pool/src/tests/pool.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
use bigint::H256;
use chain_spec::consensus::Consensus;
use channel::{self, Receiver};
use ckb_chain::chain::{ChainBuilder, ChainController};
use ckb_chain_spec::consensus::Consensus;
use ckb_core::block::{Block, BlockBuilder};
use ckb_core::cell::{CellProvider, CellStatus};
use ckb_core::header::HeaderBuilder;
use ckb_core::script::Script;
use ckb_core::transaction::*;
use ckb_db::memorydb::MemoryKeyValueDB;
use ckb_notify::{ForkBlocks, MsgNewTip, MsgSwitchFork, NotifyService, TXS_POOL_SUBSCRIBER};
use ckb_shared::index::ChainIndex;
use ckb_shared::shared::{ChainProvider, Shared, SharedBuilder};
use ckb_shared::store::ChainKVStore;
use core::block::{Block, BlockBuilder};
use core::cell::{CellProvider, CellStatus};
use core::header::HeaderBuilder;
use core::script::Script;
use core::transaction::*;
use ckb_time::now_ms;
use std::fs::File;
use std::io::Read;
use std::sync::Arc;
use std::time;
use time::now_ms;
use txs_pool::pool::TransactionPoolService;
use txs_pool::types::*;

Expand Down
10 changes: 5 additions & 5 deletions pool/src/txs_pool/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ use super::types::{
};
use bigint::H256;
use channel::{self, Receiver, Sender};
use ckb_core::block::Block;
use ckb_core::cell::{CellProvider, CellStatus};
use ckb_core::service::{Request, DEFAULT_CHANNEL_SIZE};
use ckb_core::transaction::{OutPoint, ProposalShortId, Transaction};
use ckb_notify::{ForkBlocks, MsgNewTip, MsgSwitchFork, NotifyController, TXS_POOL_SUBSCRIBER};
use ckb_shared::index::ChainIndex;
use ckb_shared::shared::{ChainProvider, Shared};
use ckb_verification::{TransactionError, TransactionVerifier};
use core::block::Block;
use core::cell::{CellProvider, CellStatus};
use core::service::{Request, DEFAULT_CHANNEL_SIZE};
use core::transaction::{OutPoint, ProposalShortId, Transaction};
use lru_cache::LruCache;
use std::thread::{self, JoinHandle};

#[cfg(test)]
use core::BlockNumber;
use ckb_core::BlockNumber;

pub type TxsArgs = (usize, usize);
pub type TxsReturn = (Vec<ProposalShortId>, Vec<Transaction>);
Expand Down
8 changes: 4 additions & 4 deletions pool/src/txs_pool/types.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! The primary module containing the implementations of the transaction pool
//! and its top-level members.

use chain_spec::consensus::{TRANSACTION_PROPAGATION_TIME, TRANSACTION_PROPAGATION_TIMEOUT};
use ckb_chain_spec::consensus::{TRANSACTION_PROPAGATION_TIME, TRANSACTION_PROPAGATION_TIMEOUT};
use ckb_core::transaction::{CellOutput, OutPoint, ProposalShortId, Transaction};
use ckb_core::BlockNumber;
use ckb_verification::TransactionError;
use core::transaction::{CellOutput, OutPoint, ProposalShortId, Transaction};
use core::BlockNumber;
use fnv::{FnvHashMap, FnvHashSet};
use linked_hash_map::LinkedHashMap;
use std::collections::VecDeque;
Expand Down Expand Up @@ -832,7 +832,7 @@ impl ProposedQueue {
mod tests {
use super::*;
use bigint::H256;
use core::transaction::{CellInput, CellOutput, Transaction, TransactionBuilder};
use ckb_core::transaction::{CellInput, CellOutput, Transaction, TransactionBuilder};

fn build_tx(inputs: Vec<(H256, u32)>, outputs_len: usize) -> Transaction {
TransactionBuilder::default()
Expand Down
Loading

0 comments on commit a3a16ae

Please sign in to comment.