Skip to content

Commit 15057e7

Browse files
core: don't emit the warning of log indexing if the db was not initialized (#31845)
1 parent 85ae3e1 commit 15057e7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

core/filtermaps/filtermaps.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ type Config struct {
227227
// NewFilterMaps creates a new FilterMaps and starts the indexer.
228228
func NewFilterMaps(db ethdb.KeyValueStore, initView *ChainView, historyCutoff, finalBlock uint64, params Params, config Config) *FilterMaps {
229229
rs, initialized, err := rawdb.ReadFilterMapsRange(db)
230-
if err != nil || rs.Version != databaseVersion {
230+
if err != nil || (initialized && rs.Version != databaseVersion) {
231231
rs, initialized = rawdb.FilterMapsRange{}, false
232232
log.Warn("Invalid log index database version; resetting log index")
233233
}

core/rawdb/accessors_indexes.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ type FilterMapsRange struct {
446446
// database entry is not present, that is interpreted as a valid non-initialized
447447
// state and returns a blank range structure and no error.
448448
func ReadFilterMapsRange(db ethdb.KeyValueReader) (FilterMapsRange, bool, error) {
449-
if has, err := db.Has(filterMapsRangeKey); !has || err != nil {
449+
if has, err := db.Has(filterMapsRangeKey); err != nil || !has {
450450
return FilterMapsRange{}, false, err
451451
}
452452
encRange, err := db.Get(filterMapsRangeKey)
@@ -457,7 +457,8 @@ func ReadFilterMapsRange(db ethdb.KeyValueReader) (FilterMapsRange, bool, error)
457457
if err := rlp.DecodeBytes(encRange, &fmRange); err != nil {
458458
return FilterMapsRange{}, false, err
459459
}
460-
return fmRange, true, err
460+
461+
return fmRange, true, nil
461462
}
462463

463464
// WriteFilterMapsRange stores the filter maps range data.

0 commit comments

Comments
 (0)