Skip to content

Commit 60d2b33

Browse files
authored
Merge pull request #2365 from CortexFoundation/dev
core: don't emit the warning of log indexing if the db was not initia…
2 parents 77867d0 + edf5a51 commit 60d2b33

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 ctxcdb.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
@@ -481,7 +481,7 @@ type FilterMapsRange struct {
481481
// database entry is not present, that is interpreted as a valid non-initialized
482482
// state and returns a blank range structure and no error.
483483
func ReadFilterMapsRange(db ctxcdb.KeyValueReader) (FilterMapsRange, bool, error) {
484-
if has, err := db.Has(filterMapsRangeKey); !has || err != nil {
484+
if has, err := db.Has(filterMapsRangeKey); err != nil || !has {
485485
return FilterMapsRange{}, false, err
486486
}
487487
encRange, err := db.Get(filterMapsRangeKey)
@@ -492,7 +492,8 @@ func ReadFilterMapsRange(db ctxcdb.KeyValueReader) (FilterMapsRange, bool, error
492492
if err := rlp.DecodeBytes(encRange, &fmRange); err != nil {
493493
return FilterMapsRange{}, false, err
494494
}
495-
return fmRange, true, err
495+
496+
return fmRange, true, nil
496497
}
497498

498499
// WriteFilterMapsRange stores the filter maps range data.

0 commit comments

Comments
 (0)