rpctest executable
This commit is contained in:
@@ -31,6 +31,13 @@ pub struct Block {
|
||||
uncles: Vec<Header>,
|
||||
}
|
||||
|
||||
impl Block {
|
||||
/// Returns block rlp.
|
||||
pub fn rlp(&self) -> Vec<u8> {
|
||||
self.rlp.clone().into()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use serde_json;
|
||||
|
||||
@@ -35,6 +35,18 @@ pub struct BlockChain {
|
||||
pre_state: State,
|
||||
}
|
||||
|
||||
impl BlockChain {
|
||||
/// Returns genesis block rlp.
|
||||
pub fn genesis_rlp(&self) -> Vec<u8> {
|
||||
self.genesis_rlp.clone().into()
|
||||
}
|
||||
|
||||
/// Returns blocks rlp.
|
||||
pub fn blocks_rlp(&self) -> Vec<Vec<u8>> {
|
||||
self.blocks.iter().map(|block| block.rlp()).collect()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use serde_json;
|
||||
|
||||
@@ -23,3 +23,11 @@ pub mod header;
|
||||
pub mod state;
|
||||
pub mod transaction;
|
||||
pub mod test;
|
||||
|
||||
pub use self::account::Account;
|
||||
pub use self::block::Block;
|
||||
pub use self::blockchain::BlockChain;
|
||||
pub use self::header::Header;
|
||||
pub use self::state::State;
|
||||
pub use self::test::Test;
|
||||
pub use self::transaction::Transaction;
|
||||
|
||||
@@ -21,6 +21,7 @@ use std::ops::Deref;
|
||||
use blockchain::blockchain::BlockChain;
|
||||
|
||||
/// Blockchain test deserializer.
|
||||
#[derive(Debug, PartialEq, Deserialize)]
|
||||
pub struct Test(BTreeMap<String, BlockChain>);
|
||||
|
||||
impl Deref for Test {
|
||||
|
||||
@@ -21,7 +21,7 @@ use serde::{Deserialize, Deserializer, Error};
|
||||
use serde::de::Visitor;
|
||||
|
||||
/// Lenient bytes json deserialization for test json files.
|
||||
#[derive(Default, Debug, PartialEq)]
|
||||
#[derive(Default, Debug, PartialEq, Clone)]
|
||||
pub struct Bytes(Vec<u8>);
|
||||
|
||||
impl Into<Vec<u8>> for Bytes {
|
||||
|
||||
Reference in New Issue
Block a user