From b32cb7a97de28e1d31ec23e87bdced2f779cc5dd Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Mon, 6 Feb 2017 15:28:16 +0100 Subject: [PATCH] make total difficulty field optional --- rpc/src/v1/impls/eth.rs | 4 ++-- rpc/src/v1/impls/light/eth.rs | 2 +- rpc/src/v1/types/block.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index 0f1f4dcc5..2105aed29 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -144,7 +144,7 @@ impl EthClient where logs_bloom: view.log_bloom().into(), timestamp: view.timestamp().into(), difficulty: view.difficulty().into(), - total_difficulty: total_difficulty.into(), + total_difficulty: Some(total_difficulty.into()), seal_fields: view.seal().into_iter().map(Into::into).collect(), uncles: block.uncle_hashes().into_iter().map(Into::into).collect(), transactions: match include_txs { @@ -194,7 +194,7 @@ impl EthClient where logs_bloom: uncle.log_bloom().clone().into(), timestamp: uncle.timestamp().into(), difficulty: uncle.difficulty().clone().into(), - total_difficulty: (uncle.difficulty().clone() + parent_difficulty).into(), + total_difficulty: Some((uncle.difficulty().clone() + parent_difficulty).into()), receipts_root: uncle.receipts_root().clone().into(), extra_data: uncle.extra_data().clone().into(), seal_fields: uncle.seal().into_iter().cloned().map(Into::into).collect(), diff --git a/rpc/src/v1/impls/light/eth.rs b/rpc/src/v1/impls/light/eth.rs index ea2f44e48..757f9edbd 100644 --- a/rpc/src/v1/impls/light/eth.rs +++ b/rpc/src/v1/impls/light/eth.rs @@ -181,7 +181,7 @@ impl Eth for EthClient { self.account(address.into(), num.0.into()).map(|acc| acc.balance.into()).boxed() } - fn storage_at(&self, address: RpcH160, key: RpcU256, num: Trailing) -> BoxFuture { + fn storage_at(&self, _address: RpcH160, _key: RpcU256, _num: Trailing) -> BoxFuture { future::err(errors::unimplemented(None)).boxed() } diff --git a/rpc/src/v1/types/block.rs b/rpc/src/v1/types/block.rs index d9848a0ac..64c792606 100644 --- a/rpc/src/v1/types/block.rs +++ b/rpc/src/v1/types/block.rs @@ -83,7 +83,7 @@ pub struct Block { pub difficulty: U256, /// Total difficulty #[serde(rename="totalDifficulty")] - pub total_difficulty: U256, + pub total_difficulty: Option, /// Seal fields #[serde(rename="sealFields")] pub seal_fields: Vec,