mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Create getBlockByNumber RPC method
This commit is contained in:
1 parent
4cf44f1b41
commit
702ee20a01
3 files changed
+11
-4
No files matched your search
@@ -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()));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user