jsonrpc optionals

This commit is contained in:
debris
2016-02-09 13:17:44 +01:00
parent 40068c1938
commit c50eb78ca1
9 changed files with 121 additions and 26 deletions

View File

@@ -31,6 +31,7 @@ use service::{NetSyncMessage, SyncMessage};
use env_info::LastHashes;
use verification::*;
use block::*;
use transaction::SignedTransaction;
pub use blockchain::TreeRoute;
/// General block status
@@ -104,6 +105,9 @@ pub trait BlockChainClient : Sync + Send {
/// Get block total difficulty.
fn block_total_difficulty_at(&self, n: BlockNumber) -> Option<U256>;
/// Get transaction with given hash.
fn transaction(&self, hash: &H256) -> Option<SignedTransaction>;
/// Get a tree route between `from` and `to`.
/// See `BlockChain::tree_route`.
fn tree_route(&self, from: &H256, to: &H256) -> Option<TreeRoute>;
@@ -388,6 +392,10 @@ impl BlockChainClient for Client {
self.chain.read().unwrap().block_hash(n).and_then(|h| self.block_total_difficulty(&h))
}
fn transaction(&self, hash: &H256) -> Option<SignedTransaction> {
self.chain.read().unwrap().transaction(hash)
}
fn tree_route(&self, from: &H256, to: &H256) -> Option<TreeRoute> {
self.chain.read().unwrap().tree_route(from.clone(), to.clone())
}

View File

@@ -98,6 +98,7 @@ pub mod ethereum;
pub mod header;
pub mod service;
pub mod spec;
pub mod transaction;
pub mod views;
pub mod receipt;
@@ -115,7 +116,6 @@ mod state;
mod account;
mod account_db;
mod action_params;
mod transaction;
mod null_engine;
mod builtin;
mod extras;

View File

@@ -156,8 +156,7 @@ impl Transaction {
}
}
/// Signed transaction information.
#[derive(Debug, Clone, Eq)]
pub struct SignedTransaction {
/// Plain Transaction.