ethereum / trin

An Ethereum portal client: a json-rpc server with nearly instant sync, and low CPU & storage usage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove contract bytecode on reverts and account self-destruct

KolbyML opened this issue · comments

#1337 (comment)

Problem

Delete contract code if no accounts point to it

This can happen in 1 of 2 cases

  • the account is deleted and the contract code is not used by any other accounts
  • we do a revert and the contract code is not used by any other accounts

Solution

The solution would require keeping a count of how many accounts point to a contract code and deleting the contract code if the count is 0. This is very low priority due to this issue being very rare and it not taking up much storage

After thoughts

I think this is super low priority almost non-existent, but there is value in documenting it so other's know to look at other things first if they are hunting for things to improve