rpc & sync recompile

This commit is contained in:
NikVolf 2016-06-30 19:53:57 +03:00
parent 8fc03e2dc2
commit ef8dd23254
7 changed files with 15 additions and 12 deletions

1
Cargo.lock generated
View File

@ -342,6 +342,7 @@ dependencies = [
"ethash 1.3.0",
"ethcore 1.3.0",
"ethcore-devtools 1.3.0",
"ethcore-ipc 1.3.0",
"ethcore-util 1.3.0",
"ethjson 0.1.0",
"ethsync 1.3.0",

View File

@ -25,6 +25,7 @@ transient-hashmap = "0.1"
serde_macros = { version = "0.7.0", optional = true }
clippy = { version = "0.0.77", optional = true}
json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" }
ethcore-ipc = { path = "../ipc/rpc" }
[build-dependencies]
serde_codegen = { version = "0.7.0", optional = true }

View File

@ -32,6 +32,7 @@ extern crate ethcore;
extern crate ethsync;
extern crate transient_hashmap;
extern crate json_ipc_server as ipc;
extern crate ethcore_ipc;
#[cfg(test)]
extern crate ethjson;

View File

@ -435,12 +435,12 @@ impl<C, S, M, EM> Eth for EthClient<C, S, M, EM> where
fn uncle_by_block_hash_and_index(&self, params: Params) -> Result<Value, Error> {
from_params::<(H256, Index)>(params)
.and_then(|(hash, index)| self.uncle(UncleID(BlockID::Hash(hash), index.value())))
.and_then(|(hash, index)| self.uncle(UncleID { block: BlockID::Hash(hash), position: index.value() }))
}
fn uncle_by_block_number_and_index(&self, params: Params) -> Result<Value, Error> {
from_params::<(BlockNumber, Index)>(params)
.and_then(|(number, index)| self.uncle(UncleID(number.into(), index.value())))
.and_then(|(number, index)| self.uncle(UncleID { block: number.into(), position: index.value() }))
}
fn compilers(&self, params: Params) -> Result<Value, Error> {

View File

@ -85,7 +85,7 @@ impl Into<EthFilter> for Filter {
VariadicValue::Single(t) => Some(vec![t]),
VariadicValue::Multiple(t) => Some(t)
}).filter_map(|m| m).collect()).into_iter();
[iter.next(), iter.next(), iter.next(), iter.next()]
vec![iter.next(), iter.next(), iter.next(), iter.next()]
}
}
}

View File

@ -162,7 +162,7 @@ pub enum Diff<T> where T: Serialize {
Changed(ChangedType<T>),
}
impl<T, U> From<account_diff::Diff<T>> for Diff<U> where T: Eq, U: Serialize + From<T> {
impl<T, U> From<account_diff::Diff<T>> for Diff<U> where T: Eq + ::ethcore_ipc::BinaryConvertable, U: Serialize + From<T> {
fn from(c: account_diff::Diff<T>) -> Self {
match c {
account_diff::Diff::Same => Diff::Same,
@ -205,7 +205,7 @@ impl Serialize for StateDiff {
impl From<state_diff::StateDiff> for StateDiff {
fn from(c: state_diff::StateDiff) -> Self {
StateDiff(c.0.into_iter().map(|(k, v)| (k, v.into())).collect())
StateDiff(c.raw.into_iter().map(|(k, v)| (k, v.into())).collect())
}
}

View File

@ -93,7 +93,7 @@ use util::*;
use std::mem::{replace};
use ethcore::views::{HeaderView, BlockView};
use ethcore::header::{BlockNumber, Header as BlockHeader};
use ethcore::client::{BlockChainClient, BlockStatus, BlockID, BlockChainInfo};
use ethcore::client::{BlockChainClient, BlockStatus, BlockID, BlockChainInfo, BlockImportError};
use ethcore::error::*;
use ethcore::block::Block;
use io::SyncIo;
@ -544,10 +544,10 @@ impl ChainSync {
peer.latest_number = Some(header.number());
}
match io.chain().import_block(block_rlp.as_raw().to_vec()) {
Err(Error::Import(ImportError::AlreadyInChain)) => {
Err(BlockImportError::Import(ImportError::AlreadyInChain)) => {
trace!(target: "sync", "New block already in chain {:?}", h);
},
Err(Error::Import(ImportError::AlreadyQueued)) => {
Err(BlockImportError::Import(ImportError::AlreadyQueued)) => {
trace!(target: "sync", "New block already queued {:?}", h);
},
Ok(_) => {
@ -557,7 +557,7 @@ impl ChainSync {
}
trace!(target: "sync", "New block queued {:?} ({})", h, header.number);
},
Err(Error::Block(BlockError::UnknownParent(p))) => {
Err(BlockImportError::Block(BlockError::UnknownParent(p))) => {
unknown = true;
trace!(target: "sync", "New block with unknown parent ({:?}) {:?}", p, h);
},
@ -841,11 +841,11 @@ impl ChainSync {
}
match io.chain().import_block(block) {
Err(Error::Import(ImportError::AlreadyInChain)) => {
Err(BlockImportError::Import(ImportError::AlreadyInChain)) => {
trace!(target: "sync", "Block already in chain {:?}", h);
self.block_imported(&h, number, &parent);
},
Err(Error::Import(ImportError::AlreadyQueued)) => {
Err(BlockImportError::Import(ImportError::AlreadyQueued)) => {
trace!(target: "sync", "Block already queued {:?}", h);
self.block_imported(&h, number, &parent);
},
@ -854,7 +854,7 @@ impl ChainSync {
imported.insert(h.clone());
self.block_imported(&h, number, &parent);
},
Err(Error::Block(BlockError::UnknownParent(_))) if self.state == SyncState::NewBlocks => {
Err(BlockImportError::Block(BlockError::UnknownParent(_))) if self.state == SyncState::NewBlocks => {
trace!(target: "sync", "Unknown new block parent, restarting sync");
break;
},