Return storage as H256 from RPC. (#1774)
* Return storage as H256 from RPC. * Fix test.
This commit is contained in:
parent
b672d51a74
commit
b29329c3c5
@ -375,7 +375,7 @@ impl<C, S: ?Sized, M, EM> Eth for EthClient<C, S, M, EM> where
|
|||||||
match block_number {
|
match block_number {
|
||||||
BlockNumber::Pending => to_value(&RpcU256::from(take_weak!(self.miner).storage_at(&*take_weak!(self.client), &address, &H256::from(position)))),
|
BlockNumber::Pending => to_value(&RpcU256::from(take_weak!(self.miner).storage_at(&*take_weak!(self.client), &address, &H256::from(position)))),
|
||||||
id => match take_weak!(self.client).storage_at(&address, &H256::from(position), id.into()) {
|
id => match take_weak!(self.client).storage_at(&address, &H256::from(position), id.into()) {
|
||||||
Some(s) => to_value(&RpcU256::from(s)),
|
Some(s) => to_value(&RpcH256::from(s)),
|
||||||
None => Err(make_unsupported_err()), // None is only returned on unsupported requests.
|
None => Err(make_unsupported_err()), // None is only returned on unsupported requests.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ fn rpc_eth_storage_at() {
|
|||||||
"params": ["0x0000000000000000000000000000000000000001", "0x4", "latest"],
|
"params": ["0x0000000000000000000000000000000000000001", "0x4", "latest"],
|
||||||
"id": 1
|
"id": 1
|
||||||
}"#;
|
}"#;
|
||||||
let response = r#"{"jsonrpc":"2.0","result":"0x07","id":1}"#;
|
let response = r#"{"jsonrpc":"2.0","result":"0x0000000000000000000000000000000000000000000000000000000000000007","id":1}"#;
|
||||||
|
|
||||||
assert_eq!(tester.io.handle_request(request), Some(response.to_owned()));
|
assert_eq!(tester.io.handle_request(request), Some(response.to_owned()));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user