Add blockNumber and blockTimestamp to ExecutionFramework

This commit is contained in:
Alex Beregszaszi committed 2017-02-10 13:24:56 +00:00
1 parent af8e31b023
commit 3128ec2ca5
4 files changed
+12

No files matched your search

+8
View File
@@ -82,6 +82,8 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256
m_rpc.test_mineBlocks(1);
RPCSession::TransactionReceipt receipt(m_rpc.eth_getTransactionReceipt(txHash));
m_blockNumber = u256(receipt.blockNumber);
if (_isCreation)
{
m_contractAddress = Address(receipt.contractAddress);
@@ -129,6 +131,12 @@ size_t ExecutionFramework::currentTimestamp()
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"});
return size_t(u256(latestBlock.get("timestamp", "invalid").asString()));
}
Address ExecutionFramework::account(size_t _i)
{
return Address(m_rpc.accountCreateIfNotExists(_i));