Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
Add assertion to check that code is never overwritten
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 committed Jun 27, 2019
1 parent 2af454b commit 6c55857
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libethereum/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,9 @@ bytes const& State::code(Address const& _addr) const

void State::setCode(Address const& _address, bytes&& _code)
{
// rollback assumes that overwriting of the code never happens
// (not allowed in contract creation logic in Executive)
assert(!addressHasCode(_address));
m_changeLog.emplace_back(Change::Code, _address);
m_cache[_address].setCode(std::move(_code));
}
Expand Down

0 comments on commit 6c55857

Please sign in to comment.