diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index bd7e09ea73b..bcfa59c7ee5 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -180,9 +180,9 @@ impl EthClient Result> { let client = &self.client; - let client_query = |id| (client.block(id), client.block_total_difficulty(id), client.block_extra_info(id)); + let client_query = |id| (client.block(id), client.block_total_difficulty(id), client.block_extra_info(id), false); - let (block, difficulty, extra) = match id { + let (block, difficulty, extra, is_pending) = match id { BlockNumberOrId::Number(BlockNumber::Pending) => { let info = self.client.chain_info(); let pending_block = self.miner.pending_block(info.best_block_number); @@ -199,7 +199,7 @@ impl EthClient { @@ -221,7 +221,10 @@ impl EthClient None, + false => Some(view.hash().into()), + }, size: Some(block.rlp().as_raw().len().into()), parent_hash: view.parent_hash().into(), uncles_hash: view.uncles_hash().into(), @@ -230,10 +233,16 @@ impl EthClient None, + false => Some(view.number().into()), + }, gas_used: view.gas_used().into(), gas_limit: view.gas_limit().into(), - logs_bloom: view.log_bloom().into(), + logs_bloom: match is_pending { + true => None, + false => Some(view.log_bloom().into()), + }, timestamp: view.timestamp().into(), difficulty: view.difficulty().into(), total_difficulty: Some(total_difficulty.into()), @@ -368,7 +377,7 @@ impl EthClient EthClient { number: Some(header.number().into()), gas_used: header.gas_used().clone().into(), gas_limit: header.gas_limit().clone().into(), - logs_bloom: header.log_bloom().clone().into(), + logs_bloom: Some(header.log_bloom().clone().into()), timestamp: header.timestamp().into(), difficulty: header.difficulty().clone().into(), total_difficulty: score.map(Into::into), @@ -570,7 +570,7 @@ fn extract_uncle_at_index(block: encoded::Block, index: Ind number: Some(uncle.number().into()), gas_used: uncle.gas_used().clone().into(), gas_limit: uncle.gas_limit().clone().into(), - logs_bloom: uncle.log_bloom().clone().into(), + logs_bloom: Some(uncle.log_bloom().clone().into()), timestamp: uncle.timestamp().into(), difficulty: uncle.difficulty().clone().into(), total_difficulty: None, diff --git a/rpc/src/v1/types/block.rs b/rpc/src/v1/types/block.rs index cd2d83e0e9f..d9c1b247c34 100644 --- a/rpc/src/v1/types/block.rs +++ b/rpc/src/v1/types/block.rs @@ -80,7 +80,7 @@ pub struct Block { pub extra_data: Bytes, /// Logs bloom #[serde(rename="logsBloom")] - pub logs_bloom: H2048, + pub logs_bloom: Option, /// Timestamp pub timestamp: U256, /// Difficulty @@ -254,7 +254,7 @@ mod tests { gas_used: U256::default(), gas_limit: U256::default(), extra_data: Bytes::default(), - logs_bloom: H2048::default(), + logs_bloom: Some(H2048::default()), timestamp: U256::default(), difficulty: U256::default(), total_difficulty: Some(U256::default()), @@ -292,7 +292,7 @@ mod tests { gas_used: U256::default(), gas_limit: U256::default(), extra_data: Bytes::default(), - logs_bloom: H2048::default(), + logs_bloom: Some(H2048::default()), timestamp: U256::default(), difficulty: U256::default(), total_difficulty: Some(U256::default()),