core/state: rm panic and use log

This commit is contained in:
YESUNFEI 2024-12-11 15:58:15 +08:00 committed by GitHub
parent 330190e476
commit caa7b86111
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -135,7 +135,8 @@ func (s *StateDB) DumpToCollector(c DumpCollector, conf *DumpConfig) (nextKey []
for it.Next() {
var data types.StateAccount
if err := rlp.DecodeBytes(it.Value, &data); err != nil {
panic(err)
log.Error("Failed to decode", "err", err)
continue
}
var (
account = DumpAccount{
@ -149,15 +150,13 @@ func (s *StateDB) DumpToCollector(c DumpCollector, conf *DumpConfig) (nextKey []
addr common.Address
addrBytes = s.trie.GetKey(it.Key)
)
if addrBytes == nil {
missingPreimages++
if conf.OnlyWithAddresses {
continue
}
} else {
if addrBytes != nil {
addr = common.BytesToAddress(addrBytes)
address = &addr
account.Address = address
account.Address = &addr
} else if conf.OnlyWithAddresses {
continue
} else {
missingPreimages++
}
obj := newObject(s, addr, &data)
if !conf.SkipCode {