Skip to content

Commit

Permalink
C++: Do not cache tx context in HostContext
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Mar 7, 2022
1 parent 9766b77 commit d33383e
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions include/evmc/evmc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@ class HostContext : public HostInterface
{
const evmc_host_interface* host = nullptr;
evmc_host_context* context = nullptr;
mutable evmc_tx_context tx_context = {};

public:
/// Default constructor for null Host context.
Expand Down Expand Up @@ -563,17 +562,7 @@ class HostContext : public HostInterface
}

/// @copydoc HostInterface::get_tx_context()
///
/// The implementation caches the received transaction context
/// by assuming that the block timestamp should never be zero.
///
/// @return The cached transaction context.
evmc_tx_context get_tx_context() const noexcept final
{
if (tx_context.block_timestamp == 0)
tx_context = host->get_tx_context(context);
return tx_context;
}
evmc_tx_context get_tx_context() const noexcept final { return host->get_tx_context(context); }

bytes32 get_block_hash(int64_t number) const noexcept final
{
Expand Down

0 comments on commit d33383e

Please sign in to comment.