aboutsummaryrefslogtreecommitdiffstats
path: root/state/dump.go
diff options
context:
space:
mode:
authorPaweł Bylica <pawel.bylica@imapp.pl>2015-03-03 01:46:55 +0800
committerPaweł Bylica <pawel.bylica@imapp.pl>2015-03-03 01:46:55 +0800
commit24003c76d12b83602ca93be375a3bc19f4fb3f1b (patch)
tree90e77c349df52806d78693f93704b92786fcb693 /state/dump.go
parent9c6d9dfc5c9fdd9aeb8f4d9926ed98008b849f2e (diff)
parent65cad14f9b27db396d036f47814d4843d947ac43 (diff)
downloaddexon-24003c76d12b83602ca93be375a3bc19f4fb3f1b.tar
dexon-24003c76d12b83602ca93be375a3bc19f4fb3f1b.tar.gz
dexon-24003c76d12b83602ca93be375a3bc19f4fb3f1b.tar.bz2
dexon-24003c76d12b83602ca93be375a3bc19f4fb3f1b.tar.lz
dexon-24003c76d12b83602ca93be375a3bc19f4fb3f1b.tar.xz
dexon-24003c76d12b83602ca93be375a3bc19f4fb3f1b.tar.zst
dexon-24003c76d12b83602ca93be375a3bc19f4fb3f1b.zip
Merge remote-tracking branch 'upstream/develop' into evmjit
Diffstat (limited to 'state/dump.go')
-rw-r--r--state/dump.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/state/dump.go b/state/dump.go
index 81895f1a3..2c611d76b 100644
--- a/state/dump.go
+++ b/state/dump.go
@@ -20,7 +20,7 @@ type World struct {
Accounts map[string]Account `json:"accounts"`
}
-func (self *StateDB) Dump() []byte {
+func (self *StateDB) RawDump() World {
world := World{
Root: ethutil.Bytes2Hex(self.trie.Root()),
Accounts: make(map[string]Account),
@@ -35,12 +35,15 @@ func (self *StateDB) Dump() []byte {
storageIt := stateObject.State.trie.Iterator()
for storageIt.Next() {
- account.Storage[ethutil.Bytes2Hex(it.Key)] = ethutil.Bytes2Hex(it.Value)
+ account.Storage[ethutil.Bytes2Hex(storageIt.Key)] = ethutil.Bytes2Hex(storageIt.Value)
}
world.Accounts[ethutil.Bytes2Hex(it.Key)] = account
}
+ return world
+}
- json, err := json.MarshalIndent(world, "", " ")
+func (self *StateDB) Dump() []byte {
+ json, err := json.MarshalIndent(self.RawDump(), "", " ")
if err != nil {
fmt.Println("dump err", err)
}