core/rawdb: don't warn for missing "unclean shutdown markers" (#28014)

This changes removes the warn-printout about not finding unclean shutdown markers, which always happens on fresh installs / wiped databases.
This commit is contained in:
Delweng 2023-09-06 18:29:51 +08:00 committed by GitHub
parent 2f77299136
commit 2e02c1ffd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,11 +111,11 @@ const crashesToKeep = 10
func PushUncleanShutdownMarker(db ethdb.KeyValueStore) ([]uint64, uint64, error) { func PushUncleanShutdownMarker(db ethdb.KeyValueStore) ([]uint64, uint64, error) {
var uncleanShutdowns crashList var uncleanShutdowns crashList
// Read old data // Read old data
if data, err := db.Get(uncleanShutdownKey); err != nil { if data, err := db.Get(uncleanShutdownKey); err == nil {
log.Warn("Error reading unclean shutdown markers", "error", err) if err := rlp.DecodeBytes(data, &uncleanShutdowns); err != nil {
} else if err := rlp.DecodeBytes(data, &uncleanShutdowns); err != nil {
return nil, 0, err return nil, 0, err
} }
}
var discarded = uncleanShutdowns.Discarded var discarded = uncleanShutdowns.Discarded
var previous = make([]uint64, len(uncleanShutdowns.Recent)) var previous = make([]uint64, len(uncleanShutdowns.Recent))
copy(previous, uncleanShutdowns.Recent) copy(previous, uncleanShutdowns.Recent)