diff --git a/core/state/dump.go b/core/state/dump.go index 500c8aee39..116e238908 100644 --- a/core/state/dump.go +++ b/core/state/dump.go @@ -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) diff --git a/trie/iterator.go b/trie/iterator.go index 6c4da9b6ba..dc8b98c102 100644 --- a/trie/iterator.go +++ b/trie/iterator.go @@ -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 {