From caa7b8611174778085e06b5408acbb4e0e4dcd7e Mon Sep 17 00:00:00 2001 From: YESUNFEI <1429460318@qq.com> Date: Wed, 11 Dec 2024 15:58:15 +0800 Subject: [PATCH] core/state: rm panic and use log --- core/state/dump.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/core/state/dump.go b/core/state/dump.go index c9aad4f8e2..e26c7f881b 100644 --- a/core/state/dump.go +++ b/core/state/dump.go @@ -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 {