Fix up the seal fields in RPC output. (#1096)
Make Ethash::extra_info() work. Seal fields now decode the RLP.
This commit is contained in:
parent
01db310cea
commit
46f3b5f913
@ -93,7 +93,9 @@ impl Engine for Ethash {
|
||||
}
|
||||
|
||||
/// Additional engine-specific information for the user/developer concerning `header`.
|
||||
fn extra_info(&self, _header: &Header) -> HashMap<String, String> { HashMap::new() }
|
||||
fn extra_info(&self, header: &Header) -> HashMap<String, String> {
|
||||
hash_map!["nonce".to_owned() => format!("0x{}", header.nonce().hex()), "mixHash".to_owned() => format!("0x{}", header.mix_hash().hex())]
|
||||
}
|
||||
|
||||
fn vm_factory(&self) -> &Factory {
|
||||
&self.factory
|
||||
|
@ -27,7 +27,7 @@ use jsonrpc_core::*;
|
||||
use util::numbers::*;
|
||||
use util::sha3::*;
|
||||
use util::bytes::{ToPretty};
|
||||
use util::rlp::{encode, UntrustedRlp, View};
|
||||
use util::rlp::{encode, decode, UntrustedRlp, View};
|
||||
use ethcore::client::*;
|
||||
use ethcore::block::IsBlock;
|
||||
use ethcore::views::*;
|
||||
@ -97,7 +97,7 @@ impl<C, S, A, M, EM> EthClient<C, S, A, M, EM>
|
||||
timestamp: U256::from(view.timestamp()),
|
||||
difficulty: view.difficulty(),
|
||||
total_difficulty: total_difficulty,
|
||||
seal_fields: view.seal().into_iter().map(Bytes::new).collect(),
|
||||
seal_fields: view.seal().into_iter().map(|f| decode(&f)).map(Bytes::new).collect(),
|
||||
uncles: block_view.uncle_hashes(),
|
||||
transactions: {
|
||||
if include_txs {
|
||||
@ -142,7 +142,7 @@ impl<C, S, A, M, EM> EthClient<C, S, A, M, EM>
|
||||
total_difficulty: uncle.difficulty + parent_difficulty,
|
||||
receipts_root: uncle.receipts_root,
|
||||
extra_data: Bytes::new(uncle.extra_data),
|
||||
seal_fields: uncle.seal.into_iter().map(Bytes::new).collect(),
|
||||
seal_fields: uncle.seal.into_iter().map(|f| decode(&f)).map(Bytes::new).collect(),
|
||||
uncles: vec![],
|
||||
transactions: BlockTransactions::Hashes(vec![]),
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user