mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
Merge 0d01e0a929 into 1100e8ba63
This commit is contained in:
commit
8533006d81
2 changed files with 12 additions and 7 deletions
|
|
@ -52,19 +52,18 @@ func (self *StateDB) RawDump() Dump {
|
||||||
if err := rlp.DecodeBytes(it.Value, &data); err != nil {
|
if err := rlp.DecodeBytes(it.Value, &data); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
code, _ := self.db.ContractCode(common.BytesToHash(it.Key), common.BytesToHash(data.CodeHash))
|
||||||
obj := newObject(nil, common.BytesToAddress(addr), data, nil)
|
|
||||||
account := DumpAccount{
|
account := DumpAccount{
|
||||||
Balance: data.Balance.String(),
|
Balance: data.Balance.String(),
|
||||||
Nonce: data.Nonce,
|
Nonce: data.Nonce,
|
||||||
Root: common.Bytes2Hex(data.Root[:]),
|
Root: common.Bytes2Hex(data.Root[:]),
|
||||||
CodeHash: common.Bytes2Hex(data.CodeHash),
|
CodeHash: common.Bytes2Hex(data.CodeHash),
|
||||||
Code: common.Bytes2Hex(obj.Code(self.db)),
|
Code: common.Bytes2Hex(code),
|
||||||
Storage: make(map[string]string),
|
Storage: make(map[string]string),
|
||||||
}
|
}
|
||||||
storageIt := trie.NewIterator(obj.getTrie(self.db).NodeIterator(nil))
|
storage := self.StorageTrie(common.BytesToAddress(addr))
|
||||||
for storageIt.Next() {
|
for it := trie.NewIterator(storage.NodeIterator(nil)); it.Next(); {
|
||||||
account.Storage[common.Bytes2Hex(self.trie.GetKey(storageIt.Key))] = common.Bytes2Hex(storageIt.Value)
|
account.Storage[common.Bytes2Hex(storage.GetKey(it.Key))] = common.Bytes2Hex(it.Value)
|
||||||
}
|
}
|
||||||
dump.Accounts[common.Bytes2Hex(addr)] = account
|
dump.Accounts[common.Bytes2Hex(addr)] = account
|
||||||
}
|
}
|
||||||
|
|
@ -76,6 +75,5 @@ func (self *StateDB) Dump() []byte {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("dump err", err)
|
fmt.Println("dump err", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return json
|
return json
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,13 @@ func (t *SecureTrie) Root() []byte {
|
||||||
|
|
||||||
func (t *SecureTrie) Copy() *SecureTrie {
|
func (t *SecureTrie) Copy() *SecureTrie {
|
||||||
cpy := *t
|
cpy := *t
|
||||||
|
if len(t.secKeyCache) > 0 {
|
||||||
|
cpy.secKeyCache = make(map[string][]byte)
|
||||||
|
for k, v := range t.secKeyCache {
|
||||||
|
cpy.secKeyCache[k] = v
|
||||||
|
}
|
||||||
|
cpy.secKeyCacheOwner = &cpy
|
||||||
|
}
|
||||||
return &cpy
|
return &cpy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue