Dont decode seal fields (#4263)
* dont decode seal * add get_block test
This commit is contained in:
parent
b0e7cd5c9d
commit
c460aec646
@ -145,7 +145,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> EthClient<C, SN, S, M, EM> where
|
|||||||
timestamp: view.timestamp().into(),
|
timestamp: view.timestamp().into(),
|
||||||
difficulty: view.difficulty().into(),
|
difficulty: view.difficulty().into(),
|
||||||
total_difficulty: total_difficulty.into(),
|
total_difficulty: total_difficulty.into(),
|
||||||
seal_fields: view.seal().into_iter().map(|f| rlp::decode(&f)).map(Bytes::new).collect(),
|
seal_fields: view.seal().into_iter().map(Into::into).collect(),
|
||||||
uncles: block.uncle_hashes().into_iter().map(Into::into).collect(),
|
uncles: block.uncle_hashes().into_iter().map(Into::into).collect(),
|
||||||
transactions: match include_txs {
|
transactions: match include_txs {
|
||||||
true => BlockTransactions::Full(block.view().localized_transactions().into_iter().map(Into::into).collect()),
|
true => BlockTransactions::Full(block.view().localized_transactions().into_iter().map(Into::into).collect()),
|
||||||
@ -197,7 +197,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> EthClient<C, SN, S, M, EM> where
|
|||||||
total_difficulty: (uncle.difficulty().clone() + parent_difficulty).into(),
|
total_difficulty: (uncle.difficulty().clone() + parent_difficulty).into(),
|
||||||
receipts_root: uncle.receipts_root().clone().into(),
|
receipts_root: uncle.receipts_root().clone().into(),
|
||||||
extra_data: uncle.extra_data().clone().into(),
|
extra_data: uncle.extra_data().clone().into(),
|
||||||
seal_fields: uncle.seal().clone().into_iter().map(|f| rlp::decode(&f)).map(Bytes::new).collect(),
|
seal_fields: uncle.seal().into_iter().cloned().map(Into::into).collect(),
|
||||||
uncles: vec![],
|
uncles: vec![],
|
||||||
transactions: BlockTransactions::Hashes(vec![]),
|
transactions: BlockTransactions::Hashes(vec![]),
|
||||||
},
|
},
|
||||||
|
@ -208,6 +208,16 @@ fn eth_block_number() {
|
|||||||
assert_eq!(tester.handler.handle_request_sync(req_number).unwrap(), res_number);
|
assert_eq!(tester.handler.handle_request_sync(req_number).unwrap(), res_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn eth_get_block() {
|
||||||
|
let chain = extract_chain!("BlockchainTests/bcRPC_API_Test");
|
||||||
|
let tester = EthTester::from_chain(&chain);
|
||||||
|
let req_block = r#"{"method":"eth_getBlockByNumber","params":["0x0",false],"id":1,"jsonrpc":"2.0"}"#;
|
||||||
|
|
||||||
|
let res_block = r#"{"jsonrpc":"2.0","result":{"author":"0x8888f1f195afa192cfee860698584c030f4c9db1","difficulty":"0x20000","extraData":"0x42","gasLimit":"0x2fefd8","gasUsed":"0x0","hash":"0x5a39ed1020c04d4d84539975b893a4e7c53eab6c2965db8bc3468093a31bc5ae","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x8888f1f195afa192cfee860698584c030f4c9db1","mixHash":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","nonce":"0x0102030405060708","number":"0x0","parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","sealFields":["0xa056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","0x880102030405060708"],"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x1ff","stateRoot":"0x7dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1","timestamp":"0x54c98c81","totalDifficulty":"0x20000","transactions":[],"transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","uncles":[]},"id":1}"#.to_owned();
|
||||||
|
assert_eq!(tester.handler.handle_request_sync(req_block).unwrap(), res_block);
|
||||||
|
}
|
||||||
|
|
||||||
// a frontier-like test with an expanded gas limit and balance on known account.
|
// a frontier-like test with an expanded gas limit and balance on known account.
|
||||||
const TRANSACTION_COUNT_SPEC: &'static [u8] = br#"{
|
const TRANSACTION_COUNT_SPEC: &'static [u8] = br#"{
|
||||||
"name": "Frontier (Test)",
|
"name": "Frontier (Test)",
|
||||||
|
Loading…
Reference in New Issue
Block a user