mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add blockNumber and blockTimestamp to ExecutionFramework
This commit is contained in:
1 parent
af8e31b023
commit
3128ec2ca5
4 files changed
+12
No files matched your search
@@ -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));
|
||||
|
||||
Reference in new issue
Block a user