mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
Merge 40be1a6a51 into b69942befe
This commit is contained in:
commit
9fd217431a
1 changed files with 14 additions and 4 deletions
|
|
@ -48,12 +48,22 @@ func (self *StateDB) RawDump() Dump {
|
||||||
it := trie.NewIterator(self.trie.NodeIterator(nil))
|
it := trie.NewIterator(self.trie.NodeIterator(nil))
|
||||||
for it.Next() {
|
for it.Next() {
|
||||||
addr := self.trie.GetKey(it.Key)
|
addr := self.trie.GetKey(it.Key)
|
||||||
|
|
||||||
|
obj, ok := self.stateObjects[common.BytesToAddress(addr)]
|
||||||
|
|
||||||
var data Account
|
var data Account
|
||||||
if err := rlp.DecodeBytes(it.Value, &data); err != nil {
|
|
||||||
panic(err)
|
if ok {
|
||||||
|
data = obj.data
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if err := rlp.DecodeBytes(it.Value, &data); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
obj = newObject(nil, common.BytesToAddress(addr), data)
|
||||||
}
|
}
|
||||||
|
|
||||||
obj := newObject(nil, common.BytesToAddress(addr), data)
|
|
||||||
account := DumpAccount{
|
account := DumpAccount{
|
||||||
Balance: data.Balance.String(),
|
Balance: data.Balance.String(),
|
||||||
Nonce: data.Nonce,
|
Nonce: data.Nonce,
|
||||||
|
|
@ -64,7 +74,7 @@ func (self *StateDB) RawDump() Dump {
|
||||||
}
|
}
|
||||||
storageIt := trie.NewIterator(obj.getTrie(self.db).NodeIterator(nil))
|
storageIt := trie.NewIterator(obj.getTrie(self.db).NodeIterator(nil))
|
||||||
for storageIt.Next() {
|
for storageIt.Next() {
|
||||||
account.Storage[common.Bytes2Hex(self.trie.GetKey(storageIt.Key))] = common.Bytes2Hex(storageIt.Value)
|
account.Storage[common.Bytes2Hex(obj.trie.GetKey(storageIt.Key))] = common.Bytes2Hex(storageIt.Value)
|
||||||
}
|
}
|
||||||
dump.Accounts[common.Bytes2Hex(addr)] = account
|
dump.Accounts[common.Bytes2Hex(addr)] = account
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue