core/vm, core/state: added storage to structured vm logging

This commit is contained in:
obscuren
2015-06-10 12:57:37 +02:00
parent 38c61f6f25
commit 6fb6e6679e
4 changed files with 39 additions and 9 deletions

View File

@ -336,6 +336,22 @@ func (self *StateObject) Nonce() uint64 {
return self.nonce
}
func (self *StateObject) EachStorage(cb func(key, value []byte)) {
// When iterating over the storage check the cache first
for h, v := range self.storage {
cb([]byte(h), v.Bytes())
}
it := self.State.trie.Iterator()
for it.Next() {
// ignore cached values
key := self.State.trie.GetKey(it.Key)
if _, ok := self.storage[string(key)]; !ok {
cb(key, it.Value)
}
}
}
//
// Encoding
//