Merge pull request #2034 from ethcore/rlp-crate

rlp as separate crate
This commit is contained in:
Robert Habermeier
2016-09-02 13:48:09 +02:00
committed by GitHub
90 changed files with 339 additions and 314 deletions

View File

@@ -15,6 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use util::*;
use rlp::*;
use network::NetworkError;
use ethcore::header::{ Header as BlockHeader};
@@ -283,11 +284,11 @@ impl BlockCollection {
transactions_root: info.transactions_root().clone(),
uncles: info.uncles_hash().clone(),
};
if header_id.transactions_root == rlp::SHA3_NULL_RLP && header_id.uncles == rlp::SHA3_EMPTY_LIST_RLP {
if header_id.transactions_root == sha3::SHA3_NULL_RLP && header_id.uncles == sha3::SHA3_EMPTY_LIST_RLP {
// empty body, just mark as downloaded
let mut body_stream = RlpStream::new_list(2);
body_stream.append_raw(&rlp::EMPTY_LIST_RLP, 1);
body_stream.append_raw(&rlp::EMPTY_LIST_RLP, 1);
body_stream.append_raw(&::rlp::EMPTY_LIST_RLP, 1);
body_stream.append_raw(&::rlp::EMPTY_LIST_RLP, 1);
block.body = Some(body_stream.out());
}
else {
@@ -337,6 +338,7 @@ mod test {
use ethcore::views::HeaderView;
use ethcore::header::BlockNumber;
use util::*;
use rlp::*;
fn is_empty(bc: &BlockCollection) -> bool {
bc.heads.is_empty() &&

View File

@@ -88,6 +88,7 @@
///
use util::*;
use rlp::*;
use network::*;
use std::mem::{replace};
use ethcore::views::{HeaderView, BlockView};
@@ -1559,6 +1560,7 @@ mod tests {
use super::*;
use ::SyncConfig;
use util::*;
use rlp::*;
use super::{PeerInfo, PeerAsking};
use ethcore::views::BlockView;
use ethcore::header::*;
@@ -1576,8 +1578,8 @@ mod tests {
let mut rlp = RlpStream::new_list(3);
rlp.append(&header);
rlp.append_raw(&rlp::EMPTY_LIST_RLP, 1);
rlp.append_raw(&rlp::EMPTY_LIST_RLP, 1);
rlp.append_raw(&::rlp::EMPTY_LIST_RLP, 1);
rlp.append_raw(&::rlp::EMPTY_LIST_RLP, 1);
rlp.out()
}

View File

@@ -34,7 +34,6 @@
//! extern crate ethcore;
//! extern crate ethsync;
//! use std::env;
//! use std::sync::Arc;
//! use io::IoChannel;
//! use ethcore::client::{Client, ClientConfig};
//! use ethsync::{EthSync, SyncConfig, ManageNetwork, NetworkConfiguration};
@@ -62,22 +61,24 @@
//! }
//! ```
#[macro_use]
extern crate log;
#[macro_use]
extern crate ethcore_util as util;
extern crate ethcore_network as network;
extern crate ethcore_io as io;
extern crate ethcore;
extern crate env_logger;
extern crate time;
extern crate rand;
extern crate semver;
extern crate parking_lot;
extern crate rlp;
#[macro_use]
extern crate log;
#[macro_use]
extern crate ethcore_util as util;
#[macro_use]
extern crate heapsize;
#[macro_use]
extern crate ethcore_ipc as ipc;
extern crate semver;
extern crate parking_lot;
mod chain;
mod blocks;