mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core/state: fix receiver name in dump.go
This commit is contained in:
parent
5cc88222f0
commit
978bce533f
1 changed files with 13 additions and 13 deletions
|
|
@ -88,17 +88,17 @@ func (d iterativeDump) onRoot(root common.Hash) {
|
||||||
}{root})
|
}{root})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *StateDB) dump(c collector, excludeCode, excludeStorage, excludeMissingPreimages bool) {
|
func (s *StateDB) dump(c collector, excludeCode, excludeStorage, excludeMissingPreimages bool) {
|
||||||
emptyAddress := (common.Address{})
|
emptyAddress := (common.Address{})
|
||||||
missingPreimages := 0
|
missingPreimages := 0
|
||||||
c.onRoot(db.trie.Hash())
|
c.onRoot(s.trie.Hash())
|
||||||
it := trie.NewIterator(db.trie.NodeIterator(nil))
|
it := trie.NewIterator(s.trie.NodeIterator(nil))
|
||||||
for it.Next() {
|
for it.Next() {
|
||||||
var data Account
|
var data Account
|
||||||
if err := rlp.DecodeBytes(it.Value, &data); err != nil {
|
if err := rlp.DecodeBytes(it.Value, &data); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
addr := common.BytesToAddress(db.trie.GetKey(it.Key))
|
addr := common.BytesToAddress(s.trie.GetKey(it.Key))
|
||||||
obj := newObject(nil, addr, data)
|
obj := newObject(nil, addr, data)
|
||||||
account := DumpAccount{
|
account := DumpAccount{
|
||||||
Balance: data.Balance.String(),
|
Balance: data.Balance.String(),
|
||||||
|
|
@ -115,18 +115,18 @@ func (db *StateDB) dump(c collector, excludeCode, excludeStorage, excludeMissing
|
||||||
account.SecureKey = it.Key
|
account.SecureKey = it.Key
|
||||||
}
|
}
|
||||||
if !excludeCode {
|
if !excludeCode {
|
||||||
account.Code = common.Bytes2Hex(obj.Code(db.db))
|
account.Code = common.Bytes2Hex(obj.Code(s.db))
|
||||||
}
|
}
|
||||||
if !excludeStorage {
|
if !excludeStorage {
|
||||||
account.Storage = make(map[common.Hash]string)
|
account.Storage = make(map[common.Hash]string)
|
||||||
storageIt := trie.NewIterator(obj.getTrie(db.db).NodeIterator(nil))
|
storageIt := trie.NewIterator(obj.getTrie(s.db).NodeIterator(nil))
|
||||||
for storageIt.Next() {
|
for storageIt.Next() {
|
||||||
_, content, _, err := rlp.Split(storageIt.Value)
|
_, content, _, err := rlp.Split(storageIt.Value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to decode the value returned by iterator", "error", err)
|
log.Error("Failed to decode the value returned by iterator", "error", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
account.Storage[common.BytesToHash(db.trie.GetKey(storageIt.Key))] = common.Bytes2Hex(content)
|
account.Storage[common.BytesToHash(s.trie.GetKey(storageIt.Key))] = common.Bytes2Hex(content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c.onAccount(addr, account)
|
c.onAccount(addr, account)
|
||||||
|
|
@ -137,17 +137,17 @@ func (db *StateDB) dump(c collector, excludeCode, excludeStorage, excludeMissing
|
||||||
}
|
}
|
||||||
|
|
||||||
// RawDump returns the entire state an a single large object
|
// RawDump returns the entire state an a single large object
|
||||||
func (db *StateDB) RawDump(excludeCode, excludeStorage, excludeMissingPreimages bool) Dump {
|
func (s *StateDB) RawDump(excludeCode, excludeStorage, excludeMissingPreimages bool) Dump {
|
||||||
dump := &Dump{
|
dump := &Dump{
|
||||||
Accounts: make(map[common.Address]DumpAccount),
|
Accounts: make(map[common.Address]DumpAccount),
|
||||||
}
|
}
|
||||||
db.dump(dump, excludeCode, excludeStorage, excludeMissingPreimages)
|
s.dump(dump, excludeCode, excludeStorage, excludeMissingPreimages)
|
||||||
return *dump
|
return *dump
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dump returns a JSON string representing the entire state as a single json-object
|
// Dump returns a JSON string representing the entire state as a single json-object
|
||||||
func (db *StateDB) Dump(excludeCode, excludeStorage, excludeMissingPreimages bool) []byte {
|
func (s *StateDB) Dump(excludeCode, excludeStorage, excludeMissingPreimages bool) []byte {
|
||||||
dump := db.RawDump(excludeCode, excludeStorage, excludeMissingPreimages)
|
dump := s.RawDump(excludeCode, excludeStorage, excludeMissingPreimages)
|
||||||
json, err := json.MarshalIndent(dump, "", " ")
|
json, err := json.MarshalIndent(dump, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("dump err", err)
|
fmt.Println("dump err", err)
|
||||||
|
|
@ -156,6 +156,6 @@ func (db *StateDB) Dump(excludeCode, excludeStorage, excludeMissingPreimages boo
|
||||||
}
|
}
|
||||||
|
|
||||||
// IterativeDump dumps out accounts as json-objects, delimited by linebreaks on stdout
|
// IterativeDump dumps out accounts as json-objects, delimited by linebreaks on stdout
|
||||||
func (db *StateDB) IterativeDump(excludeCode, excludeStorage, excludeMissingPreimages bool, output *json.Encoder) {
|
func (s *StateDB) IterativeDump(excludeCode, excludeStorage, excludeMissingPreimages bool, output *json.Encoder) {
|
||||||
db.dump(iterativeDump{output}, excludeCode, excludeStorage, excludeMissingPreimages)
|
s.dump(iterativeDump{output}, excludeCode, excludeStorage, excludeMissingPreimages)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue