mirror of https://github.com/status-im/evmc.git
examples: Rewrite get_storage() not to create empty entries
This commit is contained in:
parent
ca74d1969f
commit
168c77457f
|
@ -59,9 +59,13 @@ public:
|
|||
|
||||
evmc::bytes32 get_storage(const evmc::address& addr, const evmc::bytes32& key) noexcept final
|
||||
{
|
||||
auto it = accounts.find(addr);
|
||||
if (it != accounts.end())
|
||||
return it->second.storage[key];
|
||||
const auto account_iter = accounts.find(addr);
|
||||
if (account_iter == accounts.end())
|
||||
return {};
|
||||
|
||||
const auto storage_iter = account_iter->second.storage.find(key);
|
||||
if (storage_iter != account_iter->second.storage.end())
|
||||
return storage_iter->second;
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue