Merge branch 'main-refactor' into rpc-shared-miner

This commit is contained in:
Tomasz Drwięga 2016-04-21 17:38:21 +02:00
commit ef9b49f0b2
9 changed files with 20 additions and 11 deletions

View File

@ -4,7 +4,7 @@ echo "#!/bin/sh\n" > $FILE
# Exit on any error
echo "set -e" >> $FILE
# Run release build
echo "cargo build --release --features dev" >> $FILE
echo "cargo build --features dev" >> $FILE
# Build tests
echo "cargo test --no-run --features dev \\" >> $FILE
echo " -p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity -p ethminer -p ethcore-webapp" >> $FILE

View File

@ -77,7 +77,7 @@ fn push_handshake_struct(cx: &ExtCtxt, push: &mut FnMut(Annotatable)) {
pub struct BinHandshake {
api_version: String,
protocol_version: String,
_reserved: Vec<u8>,
reserved: Vec<u8>,
}
).unwrap();
@ -306,7 +306,7 @@ fn strip_ptr(ty: &P<ast::Ty>) -> P<ast::Ty> {
}
fn has_ptr(ty: &P<ast::Ty>) -> bool {
if let ast::TyKind::Rptr(_, ref ptr_mut) = ty.node {
if let ast::TyKind::Rptr(_, ref _ptr_mut) = ty.node {
true
}
else { false }
@ -625,7 +625,7 @@ fn push_client_implementation(
let payload = BinHandshake {
protocol_version: $item_ident::protocol_version().to_string(),
api_version: $item_ident::api_version().to_string(),
_reserved: vec![0u8; 64],
reserved: vec![0u8; 64],
};
let mut socket_ref = self.socket.borrow_mut();

View File

@ -138,11 +138,11 @@ pub fn push_bin_box(
let serialize_impl = quote_item!(cx,
impl ::serde::ser::Serialize for $ident {
fn serialize<__S>(&self, _serializer: &mut __S) -> ::std::result::Result<(), __S::Error>
fn serialize<__S>(&self, serializer: &mut __S) -> ::std::result::Result<(), __S::Error>
where __S: ::serde::ser::Serializer
{
let &$ident(ref val) = self;
_serializer.serialize_bytes(val.as_slice())
serializer.serialize_bytes(val.as_slice())
}
}).unwrap();

View File

@ -16,7 +16,7 @@
//! Engine deserialization.
use serde::{Deserializer, Error};
use serde::Deserializer;
use serde::de::Visitor;
use spec::Ethash;

View File

@ -230,7 +230,7 @@ impl TransactionSet {
by_hash.remove(&order.hash)
.expect("Hash found in `by_priorty` matches the one dropped; so it is included in `by_hash`");
let max = removed.get(&sender).map(|val| cmp::max(*val, nonce)).unwrap_or(nonce);
let max = removed.get(&sender).map_or(nonce, |val| cmp::max(*val, nonce));
removed.insert(sender, max);
removed
}))

View File

@ -18,6 +18,7 @@
// while not included in binary
#![allow(dead_code)]
#![cfg_attr(feature="dev", allow(used_underscore_binding))]
pub mod service;
@ -41,6 +42,12 @@ pub struct Hypervisor {
processes: RwLock<HashMap<BinaryId, Child>>,
}
impl Default for Hypervisor {
fn default() -> Self {
Hypervisor::new()
}
}
impl Hypervisor {
/// initializes the Hypervisor service with the open ipc socket for incoming clients
pub fn new() -> Hypervisor {

View File

@ -21,6 +21,7 @@ use std::collections::*;
use std::fs::{File, create_dir_all};
use std::env;
use std::io::{Read, Write};
use std::path::PathBuf;
#[cfg_attr(feature="dev", allow(enum_variant_names))]
#[derive(Debug)]
@ -99,7 +100,7 @@ fn with_locked_version<F>(db_path: Option<&str>, script: F) -> Result<usize, Err
let mut path = env::home_dir().expect("Applications should have a home dir");
path.push(".parity");
path
}, |s| ::std::path::PathBuf::from(s));
}, PathBuf::from);
try!(create_dir_all(&path).map_err(|_| Error::CannotCreateConfigPath));
path.push("ver.lock");

View File

@ -156,6 +156,7 @@ fn rpc_ethcore_dev_logs_levels() {
assert_eq!(io.handle_request(request), Some(response.to_owned()));
}
#[test]
fn rpc_ethcore_set_transactions_limit() {
let miner = miner_service();
let ethcore = EthcoreClient::new(&miner, logger()).to_delegate();

View File

@ -495,6 +495,8 @@ fn populate_big_types() {
#[test]
fn raw_bytes_from_tuple() {
type Tup = (Vec<u16>, u16);
let tup = (vec![1u16, 1u16, 1u16, 1u16], 10u16);
let bytes = vec![
// map
@ -507,8 +509,6 @@ fn raw_bytes_from_tuple() {
// 10u16
10u8, 0u8];
type Tup = (Vec<u16>, u16);
let tup_from = Tup::from_bytes(&bytes).unwrap();
assert_eq!(tup, tup_from);