aboutsummaryrefslogtreecommitdiffstats
path: root/state/dump.go
diff options
context:
space:
mode:
authorAlexandre Van de Sande <alex.vandesande@ethdev.com>2015-03-04 21:04:07 +0800
committerAlexandre Van de Sande <alex.vandesande@ethdev.com>2015-03-04 21:04:07 +0800
commit5f25c117eb6a1145b18fc13ebc03e4dc570b908e (patch)
treef5296850d29c08179ac9f51c925463d880e2db08 /state/dump.go
parentcf880f78d5e85d563654ac8277c1d51bf8c382c2 (diff)
parenta56243075a7527d65d14c4cf3480029feb0a1e3f (diff)
downloaddexon-5f25c117eb6a1145b18fc13ebc03e4dc570b908e.tar
dexon-5f25c117eb6a1145b18fc13ebc03e4dc570b908e.tar.gz
dexon-5f25c117eb6a1145b18fc13ebc03e4dc570b908e.tar.bz2
dexon-5f25c117eb6a1145b18fc13ebc03e4dc570b908e.tar.lz
dexon-5f25c117eb6a1145b18fc13ebc03e4dc570b908e.tar.xz
dexon-5f25c117eb6a1145b18fc13ebc03e4dc570b908e.tar.zst
dexon-5f25c117eb6a1145b18fc13ebc03e4dc570b908e.zip
Merge branch 'develop' into ui
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)
}