py-evm
py-evm copied to clipboard
allow db implementations to have iterable views
What is wrong?
currently, an AtomicDB cannot be iterated over. this makes it tricky to inspect, ex.
>>> t.env.vm.state._db.items()
ItemsView(<eth.db.atomic.AtomicDB object at 0x7fdf23f260e0>)
>>> list(t.env.vm.state._db.items())
NotImplementedError: By default, DB classes cannot return the total number of keys.
How can it be fixed
probably, add __iter__ and __len__ methods to all useful db classes