Merge branch 'master' into sync
This commit is contained in:
commit
693f01393d
|
@ -2,7 +2,7 @@
|
|||
name = "pbtc"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"clap 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.16.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"db 0.1.0",
|
||||
"env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"keys 0.1.0",
|
||||
|
@ -14,6 +14,16 @@ dependencies = [
|
|||
"verification 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "abstract-ns"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"futures 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quick-error 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.5.3"
|
||||
|
@ -82,7 +92,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.14.0"
|
||||
version = "2.16.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -124,6 +134,17 @@ dependencies = [
|
|||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "domain"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "elastic-array"
|
||||
version = "0.5.0"
|
||||
|
@ -144,7 +165,7 @@ version = "0.5.6"
|
|||
source = "git+https://github.com/ethcore/rust-secp256k1#f998f9a8c18227af200f0f7fdadf8a6560d391ff"
|
||||
dependencies = [
|
||||
"arrayvec 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gcc 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -159,7 +180,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -171,13 +192,13 @@ version = "0.1.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gcc"
|
||||
version = "0.3.37"
|
||||
version = "0.3.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rayon 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -328,6 +349,17 @@ dependencies = [
|
|||
"odds 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ns-dns-tokio"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"abstract-ns 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"domain 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "0.2.13"
|
||||
|
@ -358,12 +390,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
name = "p2p"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"abstract-ns 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitcrypto 0.1.0",
|
||||
"chain 0.1.0",
|
||||
"futures 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-cpupool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"message 0.1.0",
|
||||
"ns-dns-tokio 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"primitives 0.1.0",
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -400,6 +433,11 @@ dependencies = [
|
|||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.3.14"
|
||||
|
@ -449,7 +487,7 @@ name = "rocksdb-sys"
|
|||
version = "0.3.0"
|
||||
source = "git+https://github.com/ethcore/rust-rocksdb#64c63ccbe1f62c2e2b39262486f9ba813793af58"
|
||||
dependencies = [
|
||||
"gcc 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -458,7 +496,7 @@ name = "rust-crypto"
|
|||
version = "0.2.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gcc 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -585,7 +623,7 @@ name = "tokio-core"
|
|||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"futures 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mio 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -659,6 +697,7 @@ version = "0.3.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum abstract-ns 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "179c25175ddfb957808aab46c48dd7d0c66a366bff79363813b527447c9f620c"
|
||||
"checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66"
|
||||
"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"
|
||||
"checksum arrayvec 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d89f1b0e242270b5b797778af0c8d182a1a2ccac5d8d6fadf414223cc0fab096"
|
||||
|
@ -667,15 +706,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
|
||||
"checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
|
||||
"checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c"
|
||||
"checksum clap 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5fa304b03c49ccbb005784fc26e985b5d2310b1d37f2c311ce90dbcd18ea5fde"
|
||||
"checksum clap 2.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7d3f517329dfa6300c8415693c54e524f777dc470265bd73dfd1ff1699c3ee30"
|
||||
"checksum crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0c5ea215664ca264da8a9d9c3be80d2eaf30923c259d03e870388eb927508f97"
|
||||
"checksum deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1614659040e711785ed8ea24219140654da1729f3ec8a47a9719d041112fe7bf"
|
||||
"checksum domain 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "725459994103308a8476a95d8115280b1359dccc06ca14291df75f37459a9e30"
|
||||
"checksum elastic-array 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4bc9250a632e7c001b741eb0ec6cee93c9a5b6d5f1879696a4b94d62b012210a"
|
||||
"checksum env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "15abd780e45b3ea4f76b4e9a26ff4843258dd8a3eed2775a0e7368c2e7936c2f"
|
||||
"checksum eth-secp256k1 0.5.6 (git+https://github.com/ethcore/rust-secp256k1)" = "<none>"
|
||||
"checksum futures 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0bd34f72c0fffc9d2f6c570fd392bf99b9c5cd1481d79809e1cc2320befc0af0"
|
||||
"checksum futures 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dd89497091f8c5d3a65c6b4baf6d2f0731937a7c9217d2f89141b21437a9d96"
|
||||
"checksum futures-cpupool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bb982bb25cd8fa5da6a8eb3a460354c984ff1113da82bcb4f0b0862b5795db82"
|
||||
"checksum gcc 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "41337e9dc80ebadf36b4f252bf7440f61bcf34f99caa170e50dcd0f9a0cdb5d8"
|
||||
"checksum gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)" = "553f11439bdefe755bf366b264820f1da70f3aaf3924e594b886beb9c831bcf5"
|
||||
"checksum heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8c80e194758495a9109566134dc06e42ea0423987d6ceca016edaa90381b3549"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "49247ec2a285bb3dcb23cbd9c35193c025e7251bfce77c1d5da97e6362dffe7f"
|
||||
|
@ -689,12 +729,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)" = "5edf9cb6be97212423aed9413dd4729d62b370b5e1c571750e882cebbbc1e3e2"
|
||||
"checksum nix 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a7bb1da2be7da3cbffda73fc681d509ffd9e665af478d2bee1907cee0bc64b2"
|
||||
"checksum nodrop 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbbadd3f4c98dea0bd3d9b4be4c0cdaf1ab57035cb2e41fce3983db5add7cc5"
|
||||
"checksum ns-dns-tokio 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "43330aab5077c311b390b62147feb44316cb5b754b97d28c92210e6c6b7baff7"
|
||||
"checksum num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "cee7e88156f3f9e19bdd598f8d6c9db7bf4078f99f8381f43a55b09648d1a6e3"
|
||||
"checksum num_cpus 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8890e6084723d57d0df8d2720b0d60c6ee67d6c93e7169630e4371e88765dcad"
|
||||
"checksum odds 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)" = "e04630a62b3f1cc8c58b4d8f2555a40136f02b420e158242936ef286a72d33a0"
|
||||
"checksum owning_ref 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8d91377085359426407a287ab16884a0111ba473aa6844ff01d4ec20ce3d75e7"
|
||||
"checksum parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "e1435e7a2a00dfebededd6c6bdbd54008001e94b4a2aadd6aef0dc4c56317621"
|
||||
"checksum parking_lot_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb1b97670a2ffadce7c397fb80a3d687c4f3060140b885621ef1653d0e5d5068"
|
||||
"checksum quick-error 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0aad603e8d7fb67da22dbdf1f4b826ce8829e406124109e73cf1b2454b93a71c"
|
||||
"checksum rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2791d88c6defac799c3f20d74f094ca33b9332612d9aef9078519c82e4fe04a5"
|
||||
"checksum rayon 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "655df67c314c30fa3055a365eae276eb88aa4f3413a352a1ab32c1320eda41ea"
|
||||
"checksum regex 0.1.77 (registry+https://github.com/rust-lang/crates.io-index)" = "64b03446c466d35b42f2a8b203c8e03ed8b91c0f17b56e1f84f7210a257aa665"
|
||||
|
|
|
@ -6,6 +6,7 @@ use ser::{
|
|||
};
|
||||
use merkle_root::merkle_root;
|
||||
use {BlockHeader, Transaction};
|
||||
use super::RepresetH256;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct Block {
|
||||
|
@ -38,15 +39,17 @@ impl From<&'static str> for Block {
|
|||
}
|
||||
}
|
||||
|
||||
impl RepresetH256 for Block {
|
||||
fn hash(&self) -> H256 {
|
||||
self.block_header.hash()
|
||||
}
|
||||
}
|
||||
|
||||
impl Block {
|
||||
pub fn new(header: BlockHeader, transactions: Vec<Transaction>) -> Self {
|
||||
Block { block_header: header, transactions: transactions }
|
||||
}
|
||||
|
||||
pub fn hash(&self) -> H256 {
|
||||
self.block_header.hash()
|
||||
}
|
||||
|
||||
/// Returns block's merkle root.
|
||||
pub fn merkle_root(&self) -> H256 {
|
||||
let hashes = self.transactions.iter().map(Transaction::hash).collect::<Vec<H256>>();
|
||||
|
@ -66,6 +69,7 @@ impl Block {
|
|||
mod tests {
|
||||
use hash::H256;
|
||||
use super::Block;
|
||||
use super::super::RepresetH256;
|
||||
|
||||
// Block 80000
|
||||
// https://blockchain.info/rawblock/000000000043a8c0fd1d6f726790caa2a406010d19efd2780db27bdbbd93baf6
|
||||
|
|
|
@ -9,6 +9,10 @@ mod block_header;
|
|||
mod merkle_root;
|
||||
mod transaction;
|
||||
|
||||
pub trait RepresetH256 {
|
||||
fn hash(&self) -> primitives::hash::H256;
|
||||
}
|
||||
|
||||
pub use rustc_serialize::hex;
|
||||
pub use primitives::{hash, bytes};
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@ use byteorder::{LittleEndian, ByteOrder};
|
|||
use primitives::hash::H256;
|
||||
use primitives::bytes::Bytes;
|
||||
use super::BlockRef;
|
||||
use {chain, serialization};
|
||||
use serialization;
|
||||
use chain::{self, RepresetH256};
|
||||
|
||||
const COL_COUNT: u32 = 10;
|
||||
const COL_META: u32 = 0;
|
||||
|
@ -262,7 +263,7 @@ mod tests {
|
|||
|
||||
use super::{Storage, Store};
|
||||
use devtools::RandomTempPath;
|
||||
use chain::Block;
|
||||
use chain::{Block, RepresetH256};
|
||||
use super::super::BlockRef;
|
||||
use test_data;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Test storage
|
||||
|
||||
use super::{BlockRef, Store, Error};
|
||||
use chain;
|
||||
use chain::{self, RepresetH256};
|
||||
use primitives::hash::H256;
|
||||
use serialization;
|
||||
use chain::bytes::Bytes;
|
||||
|
|
|
@ -11,8 +11,9 @@ futures-cpupool = "0.1"
|
|||
time = "0.1"
|
||||
rand = "0.3"
|
||||
log = "0.3"
|
||||
abstract-ns = "0.2.1"
|
||||
ns-dns-tokio = "0.1.0"
|
||||
|
||||
primitives = { path = "../primitives" }
|
||||
bitcrypto = { path = "../crypto" }
|
||||
message = { path = "../message" }
|
||||
chain = { path = "../chain" }
|
||||
|
|
|
@ -18,5 +18,5 @@ pub struct Config {
|
|||
/// Connect only ot these nodes.
|
||||
pub peers: Vec<IpAddr>,
|
||||
/// Connect to these nodes to retrieve peer addresses, and disconnect.
|
||||
pub seeds: Vec<IpAddr>,
|
||||
pub seeds: Vec<String>,
|
||||
}
|
||||
|
|
|
@ -7,8 +7,9 @@ extern crate tokio_core;
|
|||
extern crate parking_lot;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate abstract_ns;
|
||||
extern crate ns_dns_tokio;
|
||||
|
||||
extern crate chain;
|
||||
extern crate bitcrypto as crypto;
|
||||
extern crate message;
|
||||
extern crate primitives;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::{io, net};
|
||||
use std::{io, net, error};
|
||||
use std::sync::Arc;
|
||||
use parking_lot::RwLock;
|
||||
use futures::{Future, finished, failed, BoxFuture};
|
||||
|
@ -6,6 +6,8 @@ use futures::stream::Stream;
|
|||
use futures_cpupool::CpuPool;
|
||||
use tokio_core::io::IoFuture;
|
||||
use tokio_core::reactor::{Handle, Remote};
|
||||
use abstract_ns::Resolver;
|
||||
use ns_dns_tokio::DnsResolver;
|
||||
use message::{Payload, MessageResult};
|
||||
use protocol::Direction;
|
||||
use net::{connect, listen, Connections, Channel, Config as NetConfig};
|
||||
|
@ -31,6 +33,7 @@ pub struct Context {
|
|||
}
|
||||
|
||||
impl Context {
|
||||
/// Creates new context with reference to local sync node, thread pool and event loop.
|
||||
pub fn new(local_sync_node: LocalSyncNodeRef, pool_handle: CpuPool, remote: Remote) -> Self {
|
||||
Context {
|
||||
connections: Default::default(),
|
||||
|
@ -41,24 +44,27 @@ impl Context {
|
|||
}
|
||||
}
|
||||
|
||||
/// Spawns a future using thread pool and schedules execution of it with event loop handle.
|
||||
pub fn spawn<F>(&self, f: F) where F: Future + Send + 'static, F::Item: Send + 'static, F::Error: Send + 'static {
|
||||
let pool_work = self.pool.spawn(f);
|
||||
self.remote.spawn(move |handle| {
|
||||
handle.spawn(pool_work.then(|_| finished(())));
|
||||
Ok(())
|
||||
self.remote.spawn(move |_handle| {
|
||||
pool_work.then(|_| finished(()))
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns addresses of recently active nodes. Sorted and limited to 1000.
|
||||
pub fn node_table_entries(&self) -> Vec<Node> {
|
||||
self.node_table.read().recently_active_nodes()
|
||||
}
|
||||
|
||||
/// Updates node table.
|
||||
pub fn update_node_table(&self, nodes: Vec<Node>) {
|
||||
trace!("Updating node table with {} entries", nodes.len());
|
||||
self.node_table.write().insert_many(nodes);
|
||||
}
|
||||
|
||||
pub fn connect<T>(context: Arc<Context>, socket: net::SocketAddr, handle: &Handle, config: &NetConfig) -> BoxedEmptyFuture where T: SessionFactory {
|
||||
/// Connect to socket using given context and handle.
|
||||
fn connect_future<T>(context: Arc<Context>, socket: net::SocketAddr, handle: &Handle, config: &NetConfig) -> BoxedEmptyFuture where T: SessionFactory {
|
||||
trace!("Trying to connect to: {}", socket);
|
||||
let connection = connect(&socket, handle, config);
|
||||
connection.then(move |result| {
|
||||
|
@ -90,6 +96,14 @@ impl Context {
|
|||
.boxed()
|
||||
}
|
||||
|
||||
/// Connect to socket using given context.
|
||||
pub fn connect<T>(context: Arc<Context>, socket: net::SocketAddr, config: NetConfig) where T: SessionFactory {
|
||||
context.remote.clone().spawn(move |handle| {
|
||||
context.pool.clone().spawn(Context::connect_future::<T>(context, socket, handle, &config))
|
||||
})
|
||||
}
|
||||
|
||||
/// Starts tcp server and listens for incomming connections.
|
||||
pub fn listen(context: Arc<Context>, handle: &Handle, config: NetConfig) -> Result<BoxedEmptyFuture, io::Error> {
|
||||
trace!("Starting tcp server");
|
||||
let listen = try!(listen(&handle, config));
|
||||
|
@ -122,6 +136,7 @@ impl Context {
|
|||
Ok(server)
|
||||
}
|
||||
|
||||
/// Called on incomming mesage.
|
||||
pub fn on_message(context: Arc<Context>, channel: Arc<Channel>) -> IoFuture<MessageResult<()>> {
|
||||
channel.read_message().then(move |result| {
|
||||
match result {
|
||||
|
@ -157,6 +172,7 @@ impl Context {
|
|||
}).boxed()
|
||||
}
|
||||
|
||||
/// Send message to a channel with given peer id.
|
||||
pub fn send_to_peer<T>(context: Arc<Context>, peer: PeerId, payload: &T) -> IoFuture<()> where T: Payload {
|
||||
match context.connections.channel(peer) {
|
||||
Some(channel) => Context::send(context, channel, payload),
|
||||
|
@ -168,6 +184,7 @@ impl Context {
|
|||
}
|
||||
}
|
||||
|
||||
/// Send message using given channel.
|
||||
pub fn send<T>(_context: Arc<Context>, channel: Arc<Channel>, payload: &T) -> IoFuture<()> where T: Payload {
|
||||
trace!("Sending {} message to {}", T::command(), channel.peer_info().address);
|
||||
channel.write_message(payload).then(move |result| {
|
||||
|
@ -186,6 +203,7 @@ impl Context {
|
|||
}).boxed()
|
||||
}
|
||||
|
||||
/// Close channel with given peer info.
|
||||
pub fn close_connection(&self, peer_info: PeerInfo) {
|
||||
if let Some(channel) = self.connections.remove(peer_info.id) {
|
||||
trace!("Disconnecting from {}", peer_info.address);
|
||||
|
@ -235,13 +253,14 @@ impl P2P {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn run(&self) -> Result<(), io::Error> {
|
||||
pub fn run(&self) -> Result<(), Box<error::Error>> {
|
||||
for peer in self.config.peers.iter() {
|
||||
self.connect::<NormalSessionFactory>(*peer);
|
||||
}
|
||||
|
||||
let resolver = try!(DnsResolver::system_config(&self.event_loop_handle));
|
||||
for seed in self.config.seeds.iter() {
|
||||
self.connect::<SeednodeSessionFactory>(*seed);
|
||||
self.connect_to_seednode(&resolver, seed);
|
||||
}
|
||||
|
||||
try!(self.listen());
|
||||
|
@ -250,12 +269,36 @@ impl P2P {
|
|||
|
||||
pub fn connect<T>(&self, ip: net::IpAddr) where T: SessionFactory {
|
||||
let socket = net::SocketAddr::new(ip, self.config.connection.magic.port());
|
||||
let connection = Context::connect::<T>(self.context.clone(), socket, &self.event_loop_handle, &self.config.connection);
|
||||
let pool_work = self.pool.spawn(connection);
|
||||
Context::connect::<T>(self.context.clone(), socket, self.config.connection.clone());
|
||||
}
|
||||
|
||||
pub fn connect_to_seednode(&self, resolver: &Resolver, seednode: &str) {
|
||||
let owned_seednode = seednode.to_owned();
|
||||
let context = self.context.clone();
|
||||
let connection_config = self.config.connection.clone();
|
||||
let dns_lookup = resolver.resolve(seednode).then(move |result| {
|
||||
match result {
|
||||
Ok(address) => match address.pick_one() {
|
||||
Some(socket) => {
|
||||
trace!("Dns lookup of seednode {} finished. Connecting to {}", owned_seednode, socket);
|
||||
Context::connect::<SeednodeSessionFactory>(context, socket, connection_config);
|
||||
},
|
||||
None => {
|
||||
trace!("Dns lookup of seednode {} resolved with no results", owned_seednode);
|
||||
}
|
||||
},
|
||||
Err(_err) => {
|
||||
trace!("Dns lookup of seednode {} failed", owned_seednode);
|
||||
}
|
||||
}
|
||||
finished(())
|
||||
});
|
||||
let pool_work = self.pool.spawn(dns_lookup);
|
||||
self.event_loop_handle.spawn(pool_work);
|
||||
}
|
||||
|
||||
fn listen(&self) -> Result<(), io::Error> {
|
||||
|
||||
fn listen(&self) -> Result<(), Box<error::Error>> {
|
||||
let server = try!(Context::listen(self.context.clone(), &self.event_loop_handle, self.config.connection.clone()));
|
||||
let pool_work = self.pool.spawn(server);
|
||||
self.event_loop_handle.spawn(pool_work);
|
||||
|
|
|
@ -6,7 +6,7 @@ pub struct Config {
|
|||
pub magic: Magic,
|
||||
pub port: u16,
|
||||
pub connect: Option<net::IpAddr>,
|
||||
pub seednode: Option<net::IpAddr>,
|
||||
pub seednode: Option<String>,
|
||||
pub print_to_console: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use std::collections::HashMap;
|
||||
use chain::Block;
|
||||
use chain::{Block, RepresetH256};
|
||||
use primitives::hash::H256;
|
||||
use best_block::BestBlock;
|
||||
|
||||
|
|
465
tools/graph.dot
465
tools/graph.dot
|
@ -8,75 +8,80 @@ digraph dependencies {
|
|||
N6[label="miner",shape=box];
|
||||
N7[label="p2p",shape=box];
|
||||
N8[label="script",shape=box];
|
||||
N9[label="verification",shape=box];
|
||||
N10[label="aho-corasick",shape=box];
|
||||
N11[label="memchr",shape=box];
|
||||
N12[label="ansi_term",shape=box];
|
||||
N13[label="arrayvec",shape=box];
|
||||
N14[label="nodrop",shape=box];
|
||||
N15[label="odds",shape=box];
|
||||
N16[label="base58",shape=box];
|
||||
N17[label="bitcrypto",shape=box];
|
||||
N18[label="primitives",shape=box];
|
||||
N19[label="rust-crypto",shape=box];
|
||||
N20[label="bitflags v0.4.0",shape=box];
|
||||
N21[label="bitflags v0.7.0",shape=box];
|
||||
N22[label="byteorder",shape=box];
|
||||
N23[label="cfg-if",shape=box];
|
||||
N24[label="chain",shape=box];
|
||||
N25[label="heapsize",shape=box];
|
||||
N26[label="rustc-serialize",shape=box];
|
||||
N27[label="serialization",shape=box];
|
||||
N28[label="libc",shape=box];
|
||||
N29[label="strsim",shape=box];
|
||||
N30[label="term_size",shape=box];
|
||||
N31[label="unicode-segmentation",shape=box];
|
||||
N32[label="unicode-width",shape=box];
|
||||
N33[label="vec_map",shape=box];
|
||||
N34[label="yaml-rust",shape=box];
|
||||
N35[label="crossbeam",shape=box];
|
||||
N36[label="elastic-array",shape=box];
|
||||
N37[label="ethcore-devtools",shape=box];
|
||||
N38[label="parking_lot",shape=box];
|
||||
N39[label="rocksdb",shape=box];
|
||||
N40[label="test-data",shape=box];
|
||||
N41[label="deque",shape=box];
|
||||
N42[label="rand",shape=box];
|
||||
N43[label="log",shape=box];
|
||||
N44[label="regex",shape=box];
|
||||
N45[label="eth-secp256k1",shape=box];
|
||||
N46[label="gcc",shape=box];
|
||||
N47[label="futures",shape=box];
|
||||
N48[label="futures-cpupool",shape=box];
|
||||
N49[label="num_cpus v1.1.0",shape=box];
|
||||
N50[label="rayon",shape=box];
|
||||
N51[label="kernel32-sys",shape=box];
|
||||
N52[label="winapi",shape=box];
|
||||
N53[label="winapi-build",shape=box];
|
||||
N54[label="lazy_static",shape=box];
|
||||
N55[label="lazycell",shape=box];
|
||||
N56[label="linked-hash-map",shape=box];
|
||||
N57[label="mio",shape=box];
|
||||
N58[label="miow",shape=box];
|
||||
N59[label="net2",shape=box];
|
||||
N60[label="nix",shape=box];
|
||||
N61[label="slab",shape=box];
|
||||
N62[label="ws2_32-sys",shape=box];
|
||||
N63[label="rustc_version",shape=box];
|
||||
N64[label="semver",shape=box];
|
||||
N65[label="void",shape=box];
|
||||
N66[label="num_cpus v0.2.13",shape=box];
|
||||
N67[label="owning_ref",shape=box];
|
||||
N68[label="time",shape=box];
|
||||
N69[label="tokio-core",shape=box];
|
||||
N70[label="parking_lot_core",shape=box];
|
||||
N71[label="smallvec",shape=box];
|
||||
N72[label="regex-syntax",shape=box];
|
||||
N73[label="thread_local",shape=box];
|
||||
N74[label="utf8-ranges",shape=box];
|
||||
N75[label="rocksdb-sys",shape=box];
|
||||
N76[label="scoped-tls",shape=box];
|
||||
N77[label="thread-id",shape=box];
|
||||
N9[label="sync",shape=box];
|
||||
N10[label="verification",shape=box];
|
||||
N11[label="abstract-ns",shape=box];
|
||||
N12[label="futures",shape=box];
|
||||
N13[label="quick-error",shape=box];
|
||||
N14[label="rand",shape=box];
|
||||
N15[label="aho-corasick",shape=box];
|
||||
N16[label="memchr",shape=box];
|
||||
N17[label="ansi_term",shape=box];
|
||||
N18[label="arrayvec",shape=box];
|
||||
N19[label="nodrop",shape=box];
|
||||
N20[label="odds",shape=box];
|
||||
N21[label="base58",shape=box];
|
||||
N22[label="bitcrypto",shape=box];
|
||||
N23[label="primitives",shape=box];
|
||||
N24[label="rust-crypto",shape=box];
|
||||
N25[label="bitflags v0.4.0",shape=box];
|
||||
N26[label="bitflags v0.7.0",shape=box];
|
||||
N27[label="byteorder",shape=box];
|
||||
N28[label="cfg-if",shape=box];
|
||||
N29[label="chain",shape=box];
|
||||
N30[label="heapsize",shape=box];
|
||||
N31[label="rustc-serialize",shape=box];
|
||||
N32[label="serialization",shape=box];
|
||||
N33[label="libc",shape=box];
|
||||
N34[label="strsim",shape=box];
|
||||
N35[label="term_size",shape=box];
|
||||
N36[label="unicode-segmentation",shape=box];
|
||||
N37[label="unicode-width",shape=box];
|
||||
N38[label="vec_map",shape=box];
|
||||
N39[label="yaml-rust",shape=box];
|
||||
N40[label="crossbeam",shape=box];
|
||||
N41[label="elastic-array",shape=box];
|
||||
N42[label="ethcore-devtools",shape=box];
|
||||
N43[label="parking_lot",shape=box];
|
||||
N44[label="rocksdb",shape=box];
|
||||
N45[label="test-data",shape=box];
|
||||
N46[label="deque",shape=box];
|
||||
N47[label="domain",shape=box];
|
||||
N48[label="tokio-core",shape=box];
|
||||
N49[label="log",shape=box];
|
||||
N50[label="regex",shape=box];
|
||||
N51[label="eth-secp256k1",shape=box];
|
||||
N52[label="gcc",shape=box];
|
||||
N53[label="futures-cpupool",shape=box];
|
||||
N54[label="num_cpus v1.1.0",shape=box];
|
||||
N55[label="rayon",shape=box];
|
||||
N56[label="kernel32-sys",shape=box];
|
||||
N57[label="winapi",shape=box];
|
||||
N58[label="winapi-build",shape=box];
|
||||
N59[label="lazy_static",shape=box];
|
||||
N60[label="lazycell",shape=box];
|
||||
N61[label="linked-hash-map",shape=box];
|
||||
N62[label="mio",shape=box];
|
||||
N63[label="miow",shape=box];
|
||||
N64[label="net2",shape=box];
|
||||
N65[label="nix",shape=box];
|
||||
N66[label="slab",shape=box];
|
||||
N67[label="ws2_32-sys",shape=box];
|
||||
N68[label="rustc_version",shape=box];
|
||||
N69[label="semver",shape=box];
|
||||
N70[label="void",shape=box];
|
||||
N71[label="ns-dns-tokio",shape=box];
|
||||
N72[label="num_cpus v0.2.13",shape=box];
|
||||
N73[label="owning_ref",shape=box];
|
||||
N74[label="time",shape=box];
|
||||
N75[label="parking_lot_core",shape=box];
|
||||
N76[label="smallvec",shape=box];
|
||||
N77[label="regex-syntax",shape=box];
|
||||
N78[label="thread_local",shape=box];
|
||||
N79[label="utf8-ranges",shape=box];
|
||||
N80[label="rocksdb-sys",shape=box];
|
||||
N81[label="scoped-tls",shape=box];
|
||||
N82[label="thread-id",shape=box];
|
||||
N0 -> N1[label="",style=dashed];
|
||||
N0 -> N2[label="",style=dashed];
|
||||
N0 -> N3[label="",style=dashed];
|
||||
|
@ -86,163 +91,189 @@ digraph dependencies {
|
|||
N0 -> N7[label="",style=dashed];
|
||||
N0 -> N8[label="",style=dashed];
|
||||
N0 -> N9[label="",style=dashed];
|
||||
N1 -> N12[label="",style=dashed];
|
||||
N1 -> N21[label="",style=dashed];
|
||||
N1 -> N28[label="",style=dashed];
|
||||
N1 -> N29[label="",style=dashed];
|
||||
N1 -> N30[label="",style=dashed];
|
||||
N1 -> N31[label="",style=dashed];
|
||||
N1 -> N32[label="",style=dashed];
|
||||
N0 -> N10[label="",style=dashed];
|
||||
N1 -> N17[label="",style=dashed];
|
||||
N1 -> N26[label="",style=dashed];
|
||||
N1 -> N33[label="",style=dashed];
|
||||
N1 -> N34[label="",style=dashed];
|
||||
N2 -> N18[label="",style=dashed];
|
||||
N2 -> N22[label="",style=dashed];
|
||||
N2 -> N24[label="",style=dashed];
|
||||
N1 -> N35[label="",style=dashed];
|
||||
N1 -> N36[label="",style=dashed];
|
||||
N1 -> N37[label="",style=dashed];
|
||||
N1 -> N38[label="",style=dashed];
|
||||
N1 -> N39[label="",style=dashed];
|
||||
N2 -> N23[label="",style=dashed];
|
||||
N2 -> N27[label="",style=dashed];
|
||||
N2 -> N36[label="",style=dashed];
|
||||
N2 -> N37[label="",style=dashed];
|
||||
N2 -> N38[label="",style=dashed];
|
||||
N2 -> N39[label="",style=dashed];
|
||||
N2 -> N40[label="",style=dashed];
|
||||
N3 -> N43[label="",style=dashed];
|
||||
N3 -> N44[label="",style=dashed];
|
||||
N4 -> N16[label="",style=dashed];
|
||||
N4 -> N17[label="",style=dashed];
|
||||
N4 -> N18[label="",style=dashed];
|
||||
N4 -> N26[label="",style=dashed];
|
||||
N4 -> N42[label="",style=dashed];
|
||||
N4 -> N45[label="",style=dashed];
|
||||
N4 -> N54[label="",style=dashed];
|
||||
N5 -> N17[label="",style=dashed];
|
||||
N5 -> N18[label="",style=dashed];
|
||||
N2 -> N29[label="",style=dashed];
|
||||
N2 -> N32[label="",style=dashed];
|
||||
N2 -> N41[label="",style=dashed];
|
||||
N2 -> N42[label="",style=dashed];
|
||||
N2 -> N43[label="",style=dashed];
|
||||
N2 -> N44[label="",style=dashed];
|
||||
N2 -> N45[label="",style=dashed];
|
||||
N3 -> N49[label="",style=dashed];
|
||||
N3 -> N50[label="",style=dashed];
|
||||
N4 -> N14[label="",style=dashed];
|
||||
N4 -> N21[label="",style=dashed];
|
||||
N4 -> N22[label="",style=dashed];
|
||||
N4 -> N23[label="",style=dashed];
|
||||
N4 -> N31[label="",style=dashed];
|
||||
N4 -> N51[label="",style=dashed];
|
||||
N4 -> N59[label="",style=dashed];
|
||||
N5 -> N22[label="",style=dashed];
|
||||
N5 -> N24[label="",style=dashed];
|
||||
N5 -> N23[label="",style=dashed];
|
||||
N5 -> N27[label="",style=dashed];
|
||||
N6 -> N18[label="",style=dashed];
|
||||
N6 -> N24[label="",style=dashed];
|
||||
N6 -> N25[label="",style=dashed];
|
||||
N6 -> N27[label="",style=dashed];
|
||||
N5 -> N29[label="",style=dashed];
|
||||
N5 -> N32[label="",style=dashed];
|
||||
N6 -> N23[label="",style=dashed];
|
||||
N6 -> N29[label="",style=dashed];
|
||||
N6 -> N30[label="",style=dashed];
|
||||
N6 -> N32[label="",style=dashed];
|
||||
N6 -> N45[label="",style=dashed];
|
||||
N7 -> N5[label="",style=dashed];
|
||||
N7 -> N17[label="",style=dashed];
|
||||
N7 -> N18[label="",style=dashed];
|
||||
N7 -> N38[label="",style=dashed];
|
||||
N7 -> N42[label="",style=dashed];
|
||||
N7 -> N11[label="",style=dashed];
|
||||
N7 -> N12[label="",style=dashed];
|
||||
N7 -> N14[label="",style=dashed];
|
||||
N7 -> N22[label="",style=dashed];
|
||||
N7 -> N23[label="",style=dashed];
|
||||
N7 -> N43[label="",style=dashed];
|
||||
N7 -> N47[label="",style=dashed];
|
||||
N7 -> N48[label="",style=dashed];
|
||||
N7 -> N68[label="",style=dashed];
|
||||
N7 -> N69[label="",style=dashed];
|
||||
N7 -> N49[label="",style=dashed];
|
||||
N7 -> N53[label="",style=dashed];
|
||||
N7 -> N71[label="",style=dashed];
|
||||
N7 -> N74[label="",style=dashed];
|
||||
N8 -> N4[label="",style=dashed];
|
||||
N8 -> N17[label="",style=dashed];
|
||||
N8 -> N18[label="",style=dashed];
|
||||
N8 -> N24[label="",style=dashed];
|
||||
N8 -> N27[label="",style=dashed];
|
||||
N9 -> N2[label="",style=dashed];
|
||||
N9 -> N18[label="",style=dashed];
|
||||
N9 -> N24[label="",style=dashed];
|
||||
N9 -> N27[label="",style=dashed];
|
||||
N9 -> N37[label="",style=dashed];
|
||||
N9 -> N38[label="",style=dashed];
|
||||
N9 -> N40[label="",style=dashed];
|
||||
N9 -> N56[label="",style=dashed];
|
||||
N10 -> N11[label="",style=dashed];
|
||||
N11 -> N28[label="",style=dashed];
|
||||
N13 -> N14[label=""];
|
||||
N13 -> N15[label=""];
|
||||
N14 -> N15[label=""];
|
||||
N17 -> N18[label="",style=dashed];
|
||||
N17 -> N19[label="",style=dashed];
|
||||
N18 -> N25[label="",style=dashed];
|
||||
N18 -> N26[label="",style=dashed];
|
||||
N19 -> N26[label="",style=dashed];
|
||||
N19 -> N28[label="",style=dashed];
|
||||
N19 -> N42[label="",style=dashed];
|
||||
N19 -> N46[label="",style=dashed];
|
||||
N19 -> N68[label="",style=dashed];
|
||||
N24 -> N17[label="",style=dashed];
|
||||
N24 -> N18[label="",style=dashed];
|
||||
N24 -> N25[label="",style=dashed];
|
||||
N24 -> N26[label="",style=dashed];
|
||||
N24 -> N27[label="",style=dashed];
|
||||
N25 -> N51[label="",style=dashed];
|
||||
N27 -> N18[label="",style=dashed];
|
||||
N27 -> N22[label="",style=dashed];
|
||||
N30 -> N28[label="",style=dashed];
|
||||
N30 -> N51[label="",style=dashed];
|
||||
N30 -> N52[label="",style=dashed];
|
||||
N37 -> N42[label="",style=dashed];
|
||||
N38 -> N67[label="",style=dashed];
|
||||
N38 -> N70[label="",style=dashed];
|
||||
N39 -> N28[label="",style=dashed];
|
||||
N39 -> N75[label="",style=dashed];
|
||||
N40 -> N24[label="",style=dashed];
|
||||
N41 -> N42[label="",style=dashed];
|
||||
N42 -> N28[label="",style=dashed];
|
||||
N44 -> N10[label="",style=dashed];
|
||||
N44 -> N11[label="",style=dashed];
|
||||
N44 -> N72[label="",style=dashed];
|
||||
N44 -> N73[label="",style=dashed];
|
||||
N44 -> N74[label="",style=dashed];
|
||||
N45 -> N13[label="",style=dashed];
|
||||
N45 -> N26[label="",style=dashed];
|
||||
N45 -> N28[label="",style=dashed];
|
||||
N45 -> N42[label="",style=dashed];
|
||||
N45 -> N46[label="",style=dashed];
|
||||
N46 -> N50[label="",style=dashed];
|
||||
N47 -> N43[label="",style=dashed];
|
||||
N48 -> N35[label="",style=dashed];
|
||||
N48 -> N47[label="",style=dashed];
|
||||
N8 -> N22[label="",style=dashed];
|
||||
N8 -> N23[label="",style=dashed];
|
||||
N8 -> N29[label="",style=dashed];
|
||||
N8 -> N32[label="",style=dashed];
|
||||
N9 -> N5[label="",style=dashed];
|
||||
N9 -> N7[label="",style=dashed];
|
||||
N9 -> N23[label="",style=dashed];
|
||||
N9 -> N29[label="",style=dashed];
|
||||
N9 -> N43[label="",style=dashed];
|
||||
N9 -> N49[label="",style=dashed];
|
||||
N10 -> N2[label="",style=dashed];
|
||||
N10 -> N8[label="",style=dashed];
|
||||
N10 -> N23[label="",style=dashed];
|
||||
N10 -> N27[label="",style=dashed];
|
||||
N10 -> N29[label="",style=dashed];
|
||||
N10 -> N32[label="",style=dashed];
|
||||
N10 -> N42[label="",style=dashed];
|
||||
N10 -> N43[label="",style=dashed];
|
||||
N10 -> N45[label="",style=dashed];
|
||||
N10 -> N61[label="",style=dashed];
|
||||
N10 -> N74[label="",style=dashed];
|
||||
N11 -> N12[label="",style=dashed];
|
||||
N11 -> N13[label="",style=dashed];
|
||||
N11 -> N14[label="",style=dashed];
|
||||
N12 -> N49[label="",style=dashed];
|
||||
N14 -> N33[label="",style=dashed];
|
||||
N15 -> N16[label="",style=dashed];
|
||||
N16 -> N33[label="",style=dashed];
|
||||
N18 -> N19[label=""];
|
||||
N18 -> N20[label=""];
|
||||
N19 -> N20[label=""];
|
||||
N22 -> N23[label="",style=dashed];
|
||||
N22 -> N24[label="",style=dashed];
|
||||
N23 -> N30[label="",style=dashed];
|
||||
N23 -> N31[label="",style=dashed];
|
||||
N24 -> N14[label="",style=dashed];
|
||||
N24 -> N31[label="",style=dashed];
|
||||
N24 -> N33[label="",style=dashed];
|
||||
N24 -> N52[label="",style=dashed];
|
||||
N24 -> N74[label="",style=dashed];
|
||||
N29 -> N22[label="",style=dashed];
|
||||
N29 -> N23[label="",style=dashed];
|
||||
N29 -> N30[label="",style=dashed];
|
||||
N29 -> N31[label="",style=dashed];
|
||||
N29 -> N32[label="",style=dashed];
|
||||
N30 -> N56[label="",style=dashed];
|
||||
N32 -> N23[label="",style=dashed];
|
||||
N32 -> N27[label="",style=dashed];
|
||||
N35 -> N33[label="",style=dashed];
|
||||
N35 -> N56[label="",style=dashed];
|
||||
N35 -> N57[label="",style=dashed];
|
||||
N42 -> N14[label="",style=dashed];
|
||||
N43 -> N73[label="",style=dashed];
|
||||
N43 -> N75[label="",style=dashed];
|
||||
N44 -> N33[label="",style=dashed];
|
||||
N44 -> N80[label="",style=dashed];
|
||||
N45 -> N23[label="",style=dashed];
|
||||
N45 -> N29[label="",style=dashed];
|
||||
N45 -> N32[label="",style=dashed];
|
||||
N46 -> N14[label="",style=dashed];
|
||||
N47 -> N12[label="",style=dashed];
|
||||
N47 -> N14[label="",style=dashed];
|
||||
N47 -> N27[label="",style=dashed];
|
||||
N47 -> N48[label="",style=dashed];
|
||||
N48 -> N12[label="",style=dashed];
|
||||
N48 -> N49[label="",style=dashed];
|
||||
N49 -> N28[label="",style=dashed];
|
||||
N50 -> N41[label="",style=dashed];
|
||||
N50 -> N42[label="",style=dashed];
|
||||
N50 -> N66[label="",style=dashed];
|
||||
N48 -> N62[label="",style=dashed];
|
||||
N48 -> N66[label="",style=dashed];
|
||||
N48 -> N81[label="",style=dashed];
|
||||
N50 -> N15[label="",style=dashed];
|
||||
N50 -> N16[label="",style=dashed];
|
||||
N50 -> N77[label="",style=dashed];
|
||||
N50 -> N78[label="",style=dashed];
|
||||
N50 -> N79[label="",style=dashed];
|
||||
N51 -> N14[label="",style=dashed];
|
||||
N51 -> N18[label="",style=dashed];
|
||||
N51 -> N31[label="",style=dashed];
|
||||
N51 -> N33[label="",style=dashed];
|
||||
N51 -> N52[label="",style=dashed];
|
||||
N51 -> N53[label="",style=dashed];
|
||||
N57 -> N28[label="",style=dashed];
|
||||
N57 -> N43[label="",style=dashed];
|
||||
N57 -> N51[label="",style=dashed];
|
||||
N57 -> N52[label="",style=dashed];
|
||||
N57 -> N55[label=""];
|
||||
N57 -> N58[label=""];
|
||||
N57 -> N59[label=""];
|
||||
N57 -> N60[label=""];
|
||||
N57 -> N61[label="",style=dashed];
|
||||
N58 -> N51[label=""];
|
||||
N58 -> N52[label=""];
|
||||
N58 -> N59[label=""];
|
||||
N58 -> N62[label=""];
|
||||
N59 -> N23[label=""];
|
||||
N59 -> N28[label=""];
|
||||
N59 -> N51[label=""];
|
||||
N59 -> N52[label=""];
|
||||
N59 -> N62[label=""];
|
||||
N60 -> N20[label=""];
|
||||
N60 -> N23[label=""];
|
||||
N60 -> N28[label=""];
|
||||
N60 -> N63[label=""];
|
||||
N60 -> N64[label=""];
|
||||
N60 -> N65[label=""];
|
||||
N62 -> N52[label=""];
|
||||
N62 -> N53[label=""];
|
||||
N63 -> N64[label=""];
|
||||
N66 -> N28[label="",style=dashed];
|
||||
N68 -> N28[label="",style=dashed];
|
||||
N68 -> N51[label="",style=dashed];
|
||||
N68 -> N52[label="",style=dashed];
|
||||
N69 -> N43[label="",style=dashed];
|
||||
N69 -> N47[label="",style=dashed];
|
||||
N69 -> N57[label="",style=dashed];
|
||||
N69 -> N61[label="",style=dashed];
|
||||
N69 -> N76[label="",style=dashed];
|
||||
N70 -> N28[label="",style=dashed];
|
||||
N70 -> N42[label="",style=dashed];
|
||||
N70 -> N51[label="",style=dashed];
|
||||
N70 -> N52[label="",style=dashed];
|
||||
N70 -> N71[label="",style=dashed];
|
||||
N73 -> N77[label="",style=dashed];
|
||||
N75 -> N28[label="",style=dashed];
|
||||
N75 -> N46[label="",style=dashed];
|
||||
N77 -> N28[label="",style=dashed];
|
||||
N77 -> N51[label="",style=dashed];
|
||||
N52 -> N55[label="",style=dashed];
|
||||
N53 -> N12[label="",style=dashed];
|
||||
N53 -> N40[label="",style=dashed];
|
||||
N53 -> N54[label="",style=dashed];
|
||||
N54 -> N33[label="",style=dashed];
|
||||
N55 -> N14[label="",style=dashed];
|
||||
N55 -> N46[label="",style=dashed];
|
||||
N55 -> N72[label="",style=dashed];
|
||||
N56 -> N57[label="",style=dashed];
|
||||
N56 -> N58[label="",style=dashed];
|
||||
N62 -> N33[label="",style=dashed];
|
||||
N62 -> N49[label="",style=dashed];
|
||||
N62 -> N56[label="",style=dashed];
|
||||
N62 -> N57[label="",style=dashed];
|
||||
N62 -> N60[label="",style=dashed];
|
||||
N62 -> N63[label="",style=dashed];
|
||||
N62 -> N64[label="",style=dashed];
|
||||
N62 -> N65[label="",style=dashed];
|
||||
N62 -> N66[label="",style=dashed];
|
||||
N63 -> N56[label="",style=dashed];
|
||||
N63 -> N57[label="",style=dashed];
|
||||
N63 -> N64[label="",style=dashed];
|
||||
N63 -> N67[label="",style=dashed];
|
||||
N64 -> N28[label="",style=dashed];
|
||||
N64 -> N33[label="",style=dashed];
|
||||
N64 -> N56[label="",style=dashed];
|
||||
N64 -> N57[label="",style=dashed];
|
||||
N64 -> N67[label="",style=dashed];
|
||||
N65 -> N25[label="",style=dashed];
|
||||
N65 -> N28[label="",style=dashed];
|
||||
N65 -> N33[label="",style=dashed];
|
||||
N65 -> N68[label="",style=dashed];
|
||||
N65 -> N69[label="",style=dashed];
|
||||
N65 -> N70[label="",style=dashed];
|
||||
N67 -> N57[label="",style=dashed];
|
||||
N67 -> N58[label="",style=dashed];
|
||||
N68 -> N69[label="",style=dashed];
|
||||
N71 -> N11[label="",style=dashed];
|
||||
N71 -> N12[label="",style=dashed];
|
||||
N71 -> N47[label="",style=dashed];
|
||||
N71 -> N48[label="",style=dashed];
|
||||
N72 -> N33[label="",style=dashed];
|
||||
N74 -> N33[label="",style=dashed];
|
||||
N74 -> N56[label="",style=dashed];
|
||||
N74 -> N57[label="",style=dashed];
|
||||
N75 -> N14[label="",style=dashed];
|
||||
N75 -> N33[label="",style=dashed];
|
||||
N75 -> N56[label="",style=dashed];
|
||||
N75 -> N57[label="",style=dashed];
|
||||
N75 -> N76[label="",style=dashed];
|
||||
N78 -> N82[label="",style=dashed];
|
||||
N80 -> N33[label="",style=dashed];
|
||||
N80 -> N52[label="",style=dashed];
|
||||
N82 -> N33[label="",style=dashed];
|
||||
N82 -> N56[label="",style=dashed];
|
||||
}
|
||||
|
|
BIN
tools/graph.png
BIN
tools/graph.png
Binary file not shown.
Before Width: | Height: | Size: 531 KiB After Width: | Height: | Size: 645 KiB |
|
@ -3,7 +3,7 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use db::{self, BlockRef};
|
||||
use chain;
|
||||
use chain::{self, RepresetH256};
|
||||
use super::{Verify, VerificationResult, Chain, Error, TransactionError};
|
||||
use utils;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! Blocks verification queue
|
||||
|
||||
use chain::Block;
|
||||
use chain::{Block, RepresetH256};
|
||||
use primitives::hash::H256;
|
||||
use super::{Chain, Verify, BlockStatus};
|
||||
use linked_hash_map::LinkedHashMap;
|
||||
|
@ -119,7 +119,7 @@ impl Queue {
|
|||
mod tests {
|
||||
use super::Queue;
|
||||
use super::super::{BlockStatus, VerificationResult, Verify, Chain, Error as VerificationError};
|
||||
use chain::Block;
|
||||
use chain::{Block, RepresetH256};
|
||||
use primitives::hash::H256;
|
||||
use test_data;
|
||||
|
||||
|
|
Loading…
Reference in New Issue