Create getBlockByNumber RPC method

This commit is contained in:
Alex Beregszaszi committed 2017-02-10 13:24:56 +00:00
1 parent 4cf44f1b41
commit 702ee20a01
3 files changed
+11 -4

No files matched your search

+2 -2
View File
@@ -127,13 +127,13 @@ void ExecutionFramework::sendEther(Address const& _to, u256 const& _value)
size_t ExecutionFramework::currentTimestamp()
{
auto latestBlock = m_rpc.rpcCall("eth_getBlockByNumber", {"\"latest\"", "false"});
auto latestBlock = m_rpc.eth_getBlockByNumber("latest", false);
return size_t(u256(latestBlock.get("timestamp", "invalid").asString()));
}
size_t ExecutionFramework::blockTimestamp(u256 _number)
{
auto latestBlock = m_rpc.rpcCall("eth_getBlockByNumber", {toString(_number), "false"});
auto latestBlock = m_rpc.eth_getBlockByNumber(toString(_number), false);
return size_t(u256(latestBlock.get("timestamp", "invalid").asString()));
}