mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
* core, trie: decode the value for storage dump * core/state: address comment Co-authored-by: gary rong <garyrong0905@gmail.com>
This commit is contained in:
parent
cf5766177a
commit
77522e51ec
2 changed files with 7 additions and 2 deletions
|
|
@ -116,7 +116,12 @@ func (s *StateDB) dump(c collector, excludeCode, excludeStorage, excludeMissingP
|
|||
account.Storage = make(map[common.Hash]string)
|
||||
storageIt := trie.NewIterator(obj.getTrie(s.db).NodeIterator(nil))
|
||||
for storageIt.Next() {
|
||||
account.Storage[common.BytesToHash(s.trie.GetKey(storageIt.Key))] = common.Bytes2Hex(storageIt.Value)
|
||||
_, content, _, err := rlp.Split(storageIt.Value)
|
||||
if err != nil {
|
||||
log.Error("Failed to decode the value returned by iterator", "error", err)
|
||||
continue
|
||||
}
|
||||
account.Storage[common.BytesToHash(s.trie.GetKey(storageIt.Key))] = common.Bytes2Hex(content)
|
||||
}
|
||||
}
|
||||
c.onAccount(addr, account)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ type Iterator struct {
|
|||
Err error
|
||||
}
|
||||
|
||||
// NewIterator creates a new key-value iterator from a Node iterator.
|
||||
// NewIterator creates a new key-value iterator from a node iterator.
|
||||
// Note that the value returned by the iterator is raw. If the content is encoded
|
||||
// (e.g. storage value is RLP-encoded), it's caller's duty to decode it.
|
||||
func NewIterator(it NodeIterator) *Iterator {
|
||||
|
|
|
|||
Loading…
Reference in a new issue