Skip to content

Commit

Permalink
Rpc small fixes (#296)
Browse files Browse the repository at this point in the history
* Fix receipt's log transaction_hash

* Block's total_difficulty default to 0

* Update ts-test
  • Loading branch information
tgmichel authored Feb 25, 2021
1 parent 918c11b commit 8ce032e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/rpc-core/src/types/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub struct Block {
/// Difficulty
pub difficulty: U256,
/// Total difficulty
pub total_difficulty: Option<U256>,
pub total_difficulty: U256,
/// Seal fields
pub seal_fields: Vec<Bytes>,
/// Uncles' hashes
Expand Down
4 changes: 2 additions & 2 deletions client/rpc/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn rich_block_build(
logs_bloom: Some(block.header.logs_bloom),
timestamp: U256::from(block.header.timestamp / 1000),
difficulty: block.header.difficulty,
total_difficulty: None,
total_difficulty: U256::zero(),
seal_fields: vec![
Bytes(block.header.mix_hash.as_bytes().to_vec()),
Bytes(block.header.nonce.as_bytes().to_vec())
Expand Down Expand Up @@ -1055,7 +1055,7 @@ impl<B, C, P, CT, BE, H: ExHashT> EthApiT for EthApi<B, C, P, CT, BE, H> where
data: Bytes(log.data.clone()),
block_hash: Some(block_hash),
block_number: Some(block.header.number),
transaction_hash: Some(hash),
transaction_hash: Some(status.transaction_hash),
transaction_index: Some(status.transaction_index.into()),
log_index: Some(U256::from(
(pre_receipts_log_index.unwrap_or(0)) + i as u32
Expand Down
6 changes: 3 additions & 3 deletions ts-tests/tests/test-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describeWithFrontier("Frontier RPC (Block)", `simple-specs.json`, (context) => {
receiptsRoot: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
size: 505,
timestamp: 0,
totalDifficulty: null,
totalDifficulty: "0",
});

expect((block as any).sealFields).to.eql([
Expand Down Expand Up @@ -85,7 +85,7 @@ describeWithFrontier("Frontier RPC (Block)", `simple-specs.json`, (context) => {
receiptsRoot: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
size: 505,
timestamp: 0,
totalDifficulty: null,
totalDifficulty: "0",
});

expect((block as any).sealFields).to.eql([
Expand Down Expand Up @@ -116,7 +116,7 @@ describeWithFrontier("Frontier RPC (Block)", `simple-specs.json`, (context) => {
receiptsRoot: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
size: 507,
timestamp: 6,
totalDifficulty: null,
totalDifficulty: "0",
//transactions: [],
transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
//uncles: []
Expand Down

0 comments on commit 8ce032e

Please sign in to comment.