Return storage as H256 from RPC. (#1774)

* Return storage as H256 from RPC.

* Fix test.
This commit is contained in:
Gav Wood 2016-07-30 14:42:52 -07:00 committed by GitHub
parent b672d51a74
commit b29329c3c5
2 changed files with 2 additions and 2 deletions

View File

@ -375,7 +375,7 @@ impl<C, S: ?Sized, M, EM> Eth for EthClient<C, S, M, EM> where
match block_number {
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()) {
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.
}
}

View File

@ -299,7 +299,7 @@ fn rpc_eth_storage_at() {
"params": ["0x0000000000000000000000000000000000000001", "0x4", "latest"],
"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()));
}