Skip to content

Commit 1152f45

Browse files
core/state: include zero-address in state dump if present (ethereum#21038)
* Include 0x0000 address into the dump if it is present * core/state: go fmt Co-authored-by: Alexey Akhunov <akhounov@gmail.com>
1 parent dd88bd8 commit 1152f45

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/state/dump.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ func (d iterativeDump) onRoot(root common.Hash) {
103103
}
104104

105105
func (s *StateDB) dump(c collector, excludeCode, excludeStorage, excludeMissingPreimages bool, start []byte, maxResults int) (nextKey []byte) {
106-
emptyAddress := (common.Address{})
107106
missingPreimages := 0
108107
c.onRoot(s.trie.Hash())
109108

@@ -114,22 +113,23 @@ func (s *StateDB) dump(c collector, excludeCode, excludeStorage, excludeMissingP
114113
if err := rlp.DecodeBytes(it.Value, &data); err != nil {
115114
panic(err)
116115
}
117-
addr := common.BytesToAddress(s.trie.GetKey(it.Key))
118-
obj := newObject(nil, addr, data)
119116
account := DumpAccount{
120117
Balance: data.Balance.String(),
121118
Nonce: data.Nonce,
122119
Root: common.Bytes2Hex(data.Root[:]),
123120
CodeHash: common.Bytes2Hex(data.CodeHash),
124121
}
125-
if emptyAddress == addr {
122+
addrBytes := s.trie.GetKey(it.Key)
123+
if addrBytes == nil {
126124
// Preimage missing
127125
missingPreimages++
128126
if excludeMissingPreimages {
129127
continue
130128
}
131129
account.SecureKey = it.Key
132130
}
131+
addr := common.BytesToAddress(addrBytes)
132+
obj := newObject(nil, addr, data)
133133
if !excludeCode {
134134
account.Code = common.Bytes2Hex(obj.Code(s.db))
135135
}

0 commit comments

Comments
 (0)