sorting rpc using uncles
This commit is contained in:
parent
ef8dd23254
commit
95538ac42c
@ -30,6 +30,7 @@ use util::sha3::*;
|
||||
use util::rlp::{encode, decode, UntrustedRlp, View};
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
use ethcore::client::{MiningBlockChainClient, BlockID, TransactionID, UncleID};
|
||||
use ethcore::header::Header as BlockHeader;
|
||||
use ethcore::block::IsBlock;
|
||||
use ethcore::views::*;
|
||||
use ethcore::ethereum::Ethash;
|
||||
@ -126,8 +127,16 @@ impl<C, S, M, EM> EthClient<C, S, M, EM> where
|
||||
|
||||
fn uncle(&self, id: UncleID) -> Result<Value, Error> {
|
||||
let client = take_weak!(self.client);
|
||||
match client.uncle(id).and_then(|u| client.block_total_difficulty(BlockID::Hash(u.parent_hash().clone())).map(|diff| (diff, u))) {
|
||||
Some((parent_difficulty, uncle)) => {
|
||||
|
||||
let uncle: BlockHeader = match client.uncle(id) {
|
||||
Some(rlp) => decode(&rlp),
|
||||
None => { return Ok(Value::Null); }
|
||||
};
|
||||
let parent_difficulty = match client.block_total_difficulty(BlockID::Hash(uncle.parent_hash().clone())) {
|
||||
Some(difficulty) => difficulty,
|
||||
None => { return Ok(Value::Null); }
|
||||
};
|
||||
|
||||
let block = Block {
|
||||
hash: OptionalValue::Value(uncle.hash()),
|
||||
parent_hash: uncle.parent_hash,
|
||||
@ -150,9 +159,6 @@ impl<C, S, M, EM> EthClient<C, S, M, EM> where
|
||||
transactions: BlockTransactions::Hashes(vec![]),
|
||||
};
|
||||
to_value(&block)
|
||||
},
|
||||
None => Ok(Value::Null)
|
||||
}
|
||||
}
|
||||
|
||||
fn sign_call(&self, request: CallRequest) -> Result<SignedTransaction, Error> {
|
||||
|
Loading…
Reference in New Issue
Block a user