Fixing clippy warnings
This commit is contained in:
parent
f7929ffdd4
commit
a950b81ee8
@ -342,7 +342,6 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn new_account() {
|
fn new_account() {
|
||||||
use rustc_serialize::hex::ToHex;
|
|
||||||
|
|
||||||
let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new());
|
let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new());
|
||||||
assert_eq!(a.rlp().to_hex(), "f8448045a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
|
assert_eq!(a.rlp().to_hex(), "f8448045a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
|
||||||
@ -354,7 +353,6 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn create_account() {
|
fn create_account() {
|
||||||
use rustc_serialize::hex::ToHex;
|
|
||||||
|
|
||||||
let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new());
|
let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new());
|
||||||
assert_eq!(a.rlp().to_hex(), "f8448045a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
|
assert_eq!(a.rlp().to_hex(), "f8448045a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
|
||||||
|
@ -200,7 +200,6 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use common::*;
|
use common::*;
|
||||||
use block::*;
|
use block::*;
|
||||||
use engine::*;
|
|
||||||
use tests::helpers::*;
|
use tests::helpers::*;
|
||||||
use util::keys::{TestAccountProvider, TestAccount};
|
use util::keys::{TestAccountProvider, TestAccount};
|
||||||
|
|
||||||
|
@ -299,7 +299,6 @@ mod tests {
|
|||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use block::*;
|
use block::*;
|
||||||
use engine::*;
|
|
||||||
use tests::helpers::*;
|
use tests::helpers::*;
|
||||||
use super::super::new_morden;
|
use super::super::new_morden;
|
||||||
|
|
||||||
|
@ -51,7 +51,6 @@ pub fn new_morden() -> Spec { Spec::load(include_bytes!("../../res/ethereum/mord
|
|||||||
mod tests {
|
mod tests {
|
||||||
use common::*;
|
use common::*;
|
||||||
use state::*;
|
use state::*;
|
||||||
use engine::*;
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use tests::helpers::*;
|
use tests::helpers::*;
|
||||||
|
|
||||||
|
@ -358,8 +358,6 @@ mod tests {
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use util::common::*;
|
use util::common::*;
|
||||||
use util::trie::*;
|
|
||||||
use util::rlp::*;
|
|
||||||
use account::*;
|
use account::*;
|
||||||
use tests::helpers::*;
|
use tests::helpers::*;
|
||||||
use devtools::*;
|
use devtools::*;
|
||||||
|
@ -22,7 +22,7 @@ use std::sync::{RwLock, Arc};
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use bloomchain::{Number, Config as BloomConfig};
|
use bloomchain::{Number, Config as BloomConfig};
|
||||||
use bloomchain::group::{BloomGroupDatabase, BloomGroupChain, GroupPosition, BloomGroup};
|
use bloomchain::group::{BloomGroupDatabase, BloomGroupChain, GroupPosition, BloomGroup};
|
||||||
use util::{FixedHash, H256, H264, Database, DBTransaction};
|
use util::{H256, H264, Database, DBTransaction};
|
||||||
use header::BlockNumber;
|
use header::BlockNumber;
|
||||||
use trace::{BlockTraces, LocalizedTrace, Config, Switch, Filter, Database as TraceDatabase, ImportRequest,
|
use trace::{BlockTraces, LocalizedTrace, Config, Switch, Filter, Database as TraceDatabase, ImportRequest,
|
||||||
DatabaseExtras};
|
DatabaseExtras};
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
use util::hash::H256;
|
use util::hash::H256;
|
||||||
use header::BlockNumber;
|
use header::BlockNumber;
|
||||||
use ipc::binary::BinaryConvertError;
|
use ipc::binary::BinaryConvertError;
|
||||||
use ipc::binary::BinaryConvertable;
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ use syntax::ast::{
|
|||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::codemap::Span;
|
use syntax::codemap::Span;
|
||||||
use syntax::ext::base::{Annotatable, ExtCtxt};
|
use syntax::ext::base::{Annotatable, ExtCtxt};
|
||||||
use syntax::ext::build::AstBuilder;
|
|
||||||
use syntax::ptr::P;
|
use syntax::ptr::P;
|
||||||
|
|
||||||
pub struct Error;
|
pub struct Error;
|
||||||
|
@ -252,14 +252,14 @@ fn binary_expr_struct(
|
|||||||
map_stmts.push(quote_stmt!(cx, map[$field_index] = total;).unwrap());
|
map_stmts.push(quote_stmt!(cx, map[$field_index] = total;).unwrap());
|
||||||
|
|
||||||
if ::syntax::print::pprust::ty_to_string(&codegen::strip_ptr(&field.ty)) == "u8" {
|
if ::syntax::print::pprust::ty_to_string(&codegen::strip_ptr(&field.ty)) == "u8" {
|
||||||
map_stmts.push(quote_stmt!(cx, total = total + 1;).unwrap());
|
map_stmts.push(quote_stmt!(cx, total += 1;).unwrap());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
map_stmts.push(quote_stmt!(cx, let size = match $field_type_ident_qualified::len_params() {
|
map_stmts.push(quote_stmt!(cx, let size = match $field_type_ident_qualified::len_params() {
|
||||||
0 => mem::size_of::<$field_type_ident>(),
|
0 => mem::size_of::<$field_type_ident>(),
|
||||||
_ => length_stack.pop_front().unwrap(),
|
_ => length_stack.pop_front().unwrap(),
|
||||||
}).unwrap());
|
}).unwrap());
|
||||||
map_stmts.push(quote_stmt!(cx, total = total + size;).unwrap());
|
map_stmts.push(quote_stmt!(cx, total += size;).unwrap());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -535,12 +535,12 @@ impl TransactionQueue {
|
|||||||
/// Update height of all transactions in future transactions set.
|
/// Update height of all transactions in future transactions set.
|
||||||
fn update_future(&mut self, sender: &Address, current_nonce: U256) {
|
fn update_future(&mut self, sender: &Address, current_nonce: U256) {
|
||||||
// We need to drain all transactions for current sender from future and reinsert them with updated height
|
// We need to drain all transactions for current sender from future and reinsert them with updated height
|
||||||
let all_nonces_from_sender = match self.future.by_address.row(&sender) {
|
let all_nonces_from_sender = match self.future.by_address.row(sender) {
|
||||||
Some(row_map) => row_map.keys().cloned().collect::<Vec<U256>>(),
|
Some(row_map) => row_map.keys().cloned().collect::<Vec<U256>>(),
|
||||||
None => vec![],
|
None => vec![],
|
||||||
};
|
};
|
||||||
for k in all_nonces_from_sender {
|
for k in all_nonces_from_sender {
|
||||||
let order = self.future.drop(&sender, &k).unwrap();
|
let order = self.future.drop(sender, &k).unwrap();
|
||||||
if k >= current_nonce {
|
if k >= current_nonce {
|
||||||
self.future.insert(*sender, k, order.update_height(k, current_nonce));
|
self.future.insert(*sender, k, order.update_height(k, current_nonce));
|
||||||
} else {
|
} else {
|
||||||
@ -554,14 +554,14 @@ impl TransactionQueue {
|
|||||||
/// Drop all transactions from given sender from `current`.
|
/// Drop all transactions from given sender from `current`.
|
||||||
/// Either moves them to `future` or removes them from queue completely.
|
/// Either moves them to `future` or removes them from queue completely.
|
||||||
fn move_all_to_future(&mut self, sender: &Address, current_nonce: U256) {
|
fn move_all_to_future(&mut self, sender: &Address, current_nonce: U256) {
|
||||||
let all_nonces_from_sender = match self.current.by_address.row(&sender) {
|
let all_nonces_from_sender = match self.current.by_address.row(sender) {
|
||||||
Some(row_map) => row_map.keys().cloned().collect::<Vec<U256>>(),
|
Some(row_map) => row_map.keys().cloned().collect::<Vec<U256>>(),
|
||||||
None => vec![],
|
None => vec![],
|
||||||
};
|
};
|
||||||
|
|
||||||
for k in all_nonces_from_sender {
|
for k in all_nonces_from_sender {
|
||||||
// Goes to future or is removed
|
// Goes to future or is removed
|
||||||
let order = self.current.drop(&sender, &k).unwrap();
|
let order = self.current.drop(sender, &k).unwrap();
|
||||||
if k >= current_nonce {
|
if k >= current_nonce {
|
||||||
self.future.insert(*sender, k, order.update_height(k, current_nonce));
|
self.future.insert(*sender, k, order.update_height(k, current_nonce));
|
||||||
} else {
|
} else {
|
||||||
@ -803,7 +803,7 @@ mod test {
|
|||||||
|
|
||||||
fn new_tx() -> SignedTransaction {
|
fn new_tx() -> SignedTransaction {
|
||||||
let keypair = KeyPair::create().unwrap();
|
let keypair = KeyPair::create().unwrap();
|
||||||
new_unsigned_tx(U256::from(123)).sign(&keypair.secret())
|
new_unsigned_tx(U256::from(123)).sign(keypair.secret())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1173,9 +1173,9 @@ mod test {
|
|||||||
let mut txq = TransactionQueue::new();
|
let mut txq = TransactionQueue::new();
|
||||||
let kp = KeyPair::create().unwrap();
|
let kp = KeyPair::create().unwrap();
|
||||||
let secret = kp.secret();
|
let secret = kp.secret();
|
||||||
let tx = new_unsigned_tx(U256::from(123)).sign(&secret);
|
let tx = new_unsigned_tx(U256::from(123)).sign(secret);
|
||||||
let tx1 = new_unsigned_tx(U256::from(124)).sign(&secret);
|
let tx1 = new_unsigned_tx(U256::from(124)).sign(secret);
|
||||||
let tx2 = new_unsigned_tx(U256::from(125)).sign(&secret);
|
let tx2 = new_unsigned_tx(U256::from(125)).sign(secret);
|
||||||
|
|
||||||
txq.add(tx, &default_nonce, TransactionOrigin::External).unwrap();
|
txq.add(tx, &default_nonce, TransactionOrigin::External).unwrap();
|
||||||
assert_eq!(txq.status().pending, 1);
|
assert_eq!(txq.status().pending, 1);
|
||||||
@ -1403,11 +1403,11 @@ mod test {
|
|||||||
// given
|
// given
|
||||||
let mut txq = TransactionQueue::new();
|
let mut txq = TransactionQueue::new();
|
||||||
let keypair = KeyPair::create().unwrap();
|
let keypair = KeyPair::create().unwrap();
|
||||||
let tx = new_unsigned_tx(U256::from(123)).sign(&keypair.secret());
|
let tx = new_unsigned_tx(U256::from(123)).sign(keypair.secret());
|
||||||
let tx2 = {
|
let tx2 = {
|
||||||
let mut tx2 = tx.deref().clone();
|
let mut tx2 = tx.deref().clone();
|
||||||
tx2.gas_price = U256::from(200);
|
tx2.gas_price = U256::from(200);
|
||||||
tx2.sign(&keypair.secret())
|
tx2.sign(keypair.secret())
|
||||||
};
|
};
|
||||||
|
|
||||||
// when
|
// when
|
||||||
@ -1426,16 +1426,16 @@ mod test {
|
|||||||
// given
|
// given
|
||||||
let mut txq = TransactionQueue::new();
|
let mut txq = TransactionQueue::new();
|
||||||
let keypair = KeyPair::create().unwrap();
|
let keypair = KeyPair::create().unwrap();
|
||||||
let tx0 = new_unsigned_tx(U256::from(123)).sign(&keypair.secret());
|
let tx0 = new_unsigned_tx(U256::from(123)).sign(keypair.secret());
|
||||||
let tx1 = {
|
let tx1 = {
|
||||||
let mut tx1 = tx0.deref().clone();
|
let mut tx1 = tx0.deref().clone();
|
||||||
tx1.nonce = U256::from(124);
|
tx1.nonce = U256::from(124);
|
||||||
tx1.sign(&keypair.secret())
|
tx1.sign(keypair.secret())
|
||||||
};
|
};
|
||||||
let tx2 = {
|
let tx2 = {
|
||||||
let mut tx2 = tx1.deref().clone();
|
let mut tx2 = tx1.deref().clone();
|
||||||
tx2.gas_price = U256::from(200);
|
tx2.gas_price = U256::from(200);
|
||||||
tx2.sign(&keypair.secret())
|
tx2.sign(keypair.secret())
|
||||||
};
|
};
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
@ -171,7 +171,7 @@ impl Configuration {
|
|||||||
let (listen, public) = self.net_addresses();
|
let (listen, public) = self.net_addresses();
|
||||||
ret.listen_address = listen;
|
ret.listen_address = listen;
|
||||||
ret.public_address = public;
|
ret.public_address = public;
|
||||||
ret.use_secret = self.args.flag_node_key.as_ref().map(|s| Secret::from_str(&s).unwrap_or_else(|_| s.sha3()));
|
ret.use_secret = self.args.flag_node_key.as_ref().map(|s| Secret::from_str(s).unwrap_or_else(|_| s.sha3()));
|
||||||
ret.discovery_enabled = !self.args.flag_no_discovery && !self.args.flag_nodiscover;
|
ret.discovery_enabled = !self.args.flag_no_discovery && !self.args.flag_nodiscover;
|
||||||
ret.ideal_peers = self.max_peers();
|
ret.ideal_peers = self.max_peers();
|
||||||
let mut net_path = PathBuf::from(&self.path());
|
let mut net_path = PathBuf::from(&self.path());
|
||||||
@ -185,7 +185,7 @@ impl Configuration {
|
|||||||
let mut latest_era = None;
|
let mut latest_era = None;
|
||||||
let jdb_types = [journaldb::Algorithm::Archive, journaldb::Algorithm::EarlyMerge, journaldb::Algorithm::OverlayRecent, journaldb::Algorithm::RefCounted];
|
let jdb_types = [journaldb::Algorithm::Archive, journaldb::Algorithm::EarlyMerge, journaldb::Algorithm::OverlayRecent, journaldb::Algorithm::RefCounted];
|
||||||
for i in jdb_types.into_iter() {
|
for i in jdb_types.into_iter() {
|
||||||
let db = journaldb::new(&append_path(&get_db_path(&Path::new(&self.path()), *i, spec.genesis_header().hash()), "state"), *i);
|
let db = journaldb::new(&append_path(&get_db_path(Path::new(&self.path()), *i, spec.genesis_header().hash()), "state"), *i);
|
||||||
trace!(target: "parity", "Looking for best DB: {} at {:?}", i, db.latest_era());
|
trace!(target: "parity", "Looking for best DB: {} at {:?}", i, db.latest_era());
|
||||||
match (latest_era, db.latest_era()) {
|
match (latest_era, db.latest_era()) {
|
||||||
(Some(best), Some(this)) if best >= this => {}
|
(Some(best), Some(this)) if best >= this => {}
|
||||||
@ -251,7 +251,7 @@ impl Configuration {
|
|||||||
let account_service = AccountService::with_security(Path::new(&self.keys_path()), self.keys_iterations());
|
let account_service = AccountService::with_security(Path::new(&self.keys_path()), self.keys_iterations());
|
||||||
if let Some(ref unlocks) = self.args.flag_unlock {
|
if let Some(ref unlocks) = self.args.flag_unlock {
|
||||||
for d in unlocks.split(',') {
|
for d in unlocks.split(',') {
|
||||||
let a = Address::from_str(clean_0x(&d)).unwrap_or_else(|_| {
|
let a = Address::from_str(clean_0x(d)).unwrap_or_else(|_| {
|
||||||
die!("{}: Invalid address for --unlock. Must be 40 hex characters, without the 0x at the beginning.", d)
|
die!("{}: Invalid address for --unlock. Must be 40 hex characters, without the 0x at the beginning.", d)
|
||||||
});
|
});
|
||||||
if passwords.iter().find(|p| account_service.unlock_account_no_expire(&a, p).is_ok()).is_none() {
|
if passwords.iter().find(|p| account_service.unlock_account_no_expire(&a, p).is_ok()).is_none() {
|
||||||
@ -302,7 +302,7 @@ impl Configuration {
|
|||||||
|
|
||||||
pub fn directories(&self) -> Directories {
|
pub fn directories(&self) -> Directories {
|
||||||
let db_path = Configuration::replace_home(
|
let db_path = Configuration::replace_home(
|
||||||
&self.args.flag_datadir.as_ref().unwrap_or(&self.args.flag_db_path));
|
self.args.flag_datadir.as_ref().unwrap_or(&self.args.flag_db_path));
|
||||||
::std::fs::create_dir_all(&db_path).unwrap_or_else(|e| die_with_io_error("main", e));
|
::std::fs::create_dir_all(&db_path).unwrap_or_else(|e| die_with_io_error("main", e));
|
||||||
|
|
||||||
let keys_path = Configuration::replace_home(&self.args.flag_keys_path);
|
let keys_path = Configuration::replace_home(&self.args.flag_keys_path);
|
||||||
|
@ -18,7 +18,6 @@ use std::sync::{RwLock,Arc};
|
|||||||
use std::ops::*;
|
use std::ops::*;
|
||||||
use ipc::IpcConfig;
|
use ipc::IpcConfig;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use ipc::BinaryConvertable;
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use ipc::binary::BinaryConvertError;
|
use ipc::binary::BinaryConvertError;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
@ -138,7 +138,7 @@ fn execute_client(conf: Configuration) {
|
|||||||
|
|
||||||
// Build client
|
// Build client
|
||||||
let mut service = ClientService::start(
|
let mut service = ClientService::start(
|
||||||
client_config, spec, net_settings, &Path::new(&conf.path())
|
client_config, spec, net_settings, Path::new(&conf.path())
|
||||||
).unwrap_or_else(|e| die_with_error("Client", e));
|
).unwrap_or_else(|e| die_with_error("Client", e));
|
||||||
|
|
||||||
panic_handler.forward_from(&service);
|
panic_handler.forward_from(&service);
|
||||||
|
@ -37,7 +37,7 @@ impl PriceInfo {
|
|||||||
.and_then(|json| json.find_path(&["result", "ethusd"])
|
.and_then(|json| json.find_path(&["result", "ethusd"])
|
||||||
.and_then(|obj| match *obj {
|
.and_then(|obj| match *obj {
|
||||||
Json::String(ref s) => Some(PriceInfo {
|
Json::String(ref s) => Some(PriceInfo {
|
||||||
ethusd: FromStr::from_str(&s).unwrap()
|
ethusd: FromStr::from_str(s).unwrap()
|
||||||
}),
|
}),
|
||||||
_ => None
|
_ => None
|
||||||
}))
|
}))
|
||||||
|
@ -31,7 +31,7 @@ pub fn setup_log(init: &Option<String>) -> Arc<RotatingLogger> {
|
|||||||
|
|
||||||
if env::var("RUST_LOG").is_ok() {
|
if env::var("RUST_LOG").is_ok() {
|
||||||
let lvl = &env::var("RUST_LOG").unwrap();
|
let lvl = &env::var("RUST_LOG").unwrap();
|
||||||
levels.push_str(&lvl);
|
levels.push_str(lvl);
|
||||||
levels.push_str(",");
|
levels.push_str(",");
|
||||||
builder.parse(lvl);
|
builder.parse(lvl);
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ fn upgrade_from_version(previous_version: &Version) -> Result<usize, Error> {
|
|||||||
if upgrade_key.is_applicable(previous_version, ¤t_version) {
|
if upgrade_key.is_applicable(previous_version, ¤t_version) {
|
||||||
let upgrade_script = upgrades[upgrade_key];
|
let upgrade_script = upgrades[upgrade_key];
|
||||||
try!(upgrade_script());
|
try!(upgrade_script());
|
||||||
count = count + 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(count)
|
Ok(count)
|
||||||
|
@ -791,8 +791,8 @@ impl ChainSync {
|
|||||||
self.downloading_hashes.remove(&hash);
|
self.downloading_hashes.remove(&hash);
|
||||||
}
|
}
|
||||||
for b in &peer.asking_blocks {
|
for b in &peer.asking_blocks {
|
||||||
self.downloading_headers.remove(&b);
|
self.downloading_headers.remove(b);
|
||||||
self.downloading_bodies.remove(&b);
|
self.downloading_bodies.remove(b);
|
||||||
}
|
}
|
||||||
peer.asking_blocks.clear();
|
peer.asking_blocks.clear();
|
||||||
}
|
}
|
||||||
@ -1255,7 +1255,7 @@ impl ChainSync {
|
|||||||
self.send_packet(io, peer_id, NEW_BLOCK_PACKET, rlp);
|
self.send_packet(io, peer_id, NEW_BLOCK_PACKET, rlp);
|
||||||
self.peers.get_mut(&peer_id).unwrap().latest_hash = chain_info.best_block_hash.clone();
|
self.peers.get_mut(&peer_id).unwrap().latest_hash = chain_info.best_block_hash.clone();
|
||||||
self.peers.get_mut(&peer_id).unwrap().latest_number = Some(chain_info.best_block_number);
|
self.peers.get_mut(&peer_id).unwrap().latest_number = Some(chain_info.best_block_number);
|
||||||
sent = sent + 1;
|
sent += 1;
|
||||||
}
|
}
|
||||||
sent
|
sent
|
||||||
}
|
}
|
||||||
@ -1271,7 +1271,7 @@ impl ChainSync {
|
|||||||
// If we think peer is too far behind just send one latest hash
|
// If we think peer is too far behind just send one latest hash
|
||||||
peer_best = last_parent.clone();
|
peer_best = last_parent.clone();
|
||||||
}
|
}
|
||||||
sent = sent + match ChainSync::create_new_hashes_rlp(io.chain(), &peer_best, &chain_info.best_block_hash) {
|
sent += match ChainSync::create_new_hashes_rlp(io.chain(), &peer_best, &chain_info.best_block_hash) {
|
||||||
Some(rlp) => {
|
Some(rlp) => {
|
||||||
{
|
{
|
||||||
let peer = self.peers.get_mut(&peer_id).unwrap();
|
let peer = self.peers.get_mut(&peer_id).unwrap();
|
||||||
@ -1668,7 +1668,7 @@ mod tests {
|
|||||||
sync.propagate_new_hashes(&chain_info, &mut io);
|
sync.propagate_new_hashes(&chain_info, &mut io);
|
||||||
|
|
||||||
let data = &io.queue[0].data.clone();
|
let data = &io.queue[0].data.clone();
|
||||||
let result = sync.on_peer_new_hashes(&mut io, 0, &UntrustedRlp::new(&data));
|
let result = sync.on_peer_new_hashes(&mut io, 0, &UntrustedRlp::new(data));
|
||||||
assert!(result.is_ok());
|
assert!(result.is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1686,7 +1686,7 @@ mod tests {
|
|||||||
sync.propagate_blocks(&chain_info, &mut io);
|
sync.propagate_blocks(&chain_info, &mut io);
|
||||||
|
|
||||||
let data = &io.queue[0].data.clone();
|
let data = &io.queue[0].data.clone();
|
||||||
let result = sync.on_peer_new_block(&mut io, 0, &UntrustedRlp::new(&data));
|
let result = sync.on_peer_new_block(&mut io, 0, &UntrustedRlp::new(data));
|
||||||
assert!(result.is_ok());
|
assert!(result.is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ impl<'c, K:'c, V:'c> Iterator for RangeIterator<'c, K, V> where K: Add<Output =
|
|||||||
}
|
}
|
||||||
match self.collection.get(self.range) {
|
match self.collection.get(self.range) {
|
||||||
Some(&(ref k, ref vec)) => {
|
Some(&(ref k, ref vec)) => {
|
||||||
Some((*k, &vec))
|
Some((*k, vec))
|
||||||
},
|
},
|
||||||
None => None
|
None => None
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
use util::*;
|
use util::*;
|
||||||
use ethcore::client::{BlockChainClient, BlockId, EachBlockWith};
|
use ethcore::client::{BlockChainClient, BlockId, EachBlockWith};
|
||||||
use io::SyncIo;
|
|
||||||
use chain::{SyncState};
|
use chain::{SyncState};
|
||||||
use super::helpers::*;
|
use super::helpers::*;
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ impl TestNet {
|
|||||||
let mut total_steps = 0;
|
let mut total_steps = 0;
|
||||||
while !self.done() {
|
while !self.done() {
|
||||||
self.sync_step();
|
self.sync_step();
|
||||||
total_steps = total_steps + 1;
|
total_steps += 1;
|
||||||
}
|
}
|
||||||
total_steps
|
total_steps
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
//! HTTP Redirection hyper handler
|
//! HTTP Redirection hyper handler
|
||||||
|
|
||||||
use std::io::Write;
|
|
||||||
use hyper::{header, server, Decoder, Encoder, Next};
|
use hyper::{header, server, Decoder, Encoder, Next};
|
||||||
use hyper::net::HttpStream;
|
use hyper::net::HttpStream;
|
||||||
use hyper::status::StatusCode;
|
use hyper::status::StatusCode;
|
||||||
|
Loading…
Reference in New Issue
Block a user