aboutsummaryrefslogtreecommitdiffstats
path: root/core/state
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-06-10 18:57:37 +0800
committerobscuren <geffobscura@gmail.com>2015-06-10 18:57:37 +0800
commit6fb6e6679eb7c329ac9013d0c879a7c4b17daca5 (patch)
tree42157e1347034cbbfb58b70baa756c5114bc8f0f /core/state
parent38c61f6f2567e7943c9a16e2be0a2bfedb3a1fb3 (diff)
downloaddexon-6fb6e6679eb7c329ac9013d0c879a7c4b17daca5.tar.gz
dexon-6fb6e6679eb7c329ac9013d0c879a7c4b17daca5.tar.zst
dexon-6fb6e6679eb7c329ac9013d0c879a7c4b17daca5.zip
core/vm, core/state: added storage to structured vm logging
Diffstat (limited to 'core/state')
-rw-r--r--core/state/state_object.go16
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
//