diff options
author | obscuren <geffobscura@gmail.com> | 2015-06-10 18:57:37 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-06-10 18:57:37 +0800 |
commit | 6fb6e6679eb7c329ac9013d0c879a7c4b17daca5 (patch) | |
tree | 42157e1347034cbbfb58b70baa756c5114bc8f0f /core/state/state_object.go | |
parent | 38c61f6f2567e7943c9a16e2be0a2bfedb3a1fb3 (diff) | |
download | go-tangerine-6fb6e6679eb7c329ac9013d0c879a7c4b17daca5.tar.gz go-tangerine-6fb6e6679eb7c329ac9013d0c879a7c4b17daca5.tar.zst go-tangerine-6fb6e6679eb7c329ac9013d0c879a7c4b17daca5.zip |
core/vm, core/state: added storage to structured vm logging
Diffstat (limited to 'core/state/state_object.go')
-rw-r--r-- | core/state/state_object.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/state/state_object.go b/core/state/state_object.go index bfc4ebc6c..6d2455d79 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -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 // |