core/filtermaps: rename noHistory field -> disabled

This commit is contained in:
Felix Lange 2025-03-13 13:12:57 +01:00
parent 2131db4fd7
commit 664ac74484
4 changed files with 12 additions and 6 deletions

View file

@ -45,14 +45,20 @@ const (
// FilterMaps is the in-memory representation of the log index structure that is
// responsible for building and updating the index according to the canonical
// chain.
//
// Note that FilterMaps implements the same data structure as proposed in EIP-7745
// without the tree hashing and consensus changes:
// https://eips.ethereum.org/EIPS/eip-7745
type FilterMaps struct {
// If disabled is set, log indexing is fully disabled.
// This is configured by the --history.logs.disable Geth flag.
// We chose to implement disabling this way because it requires less special
// case logic in eth/filters.
disabled bool
closeCh chan struct{}
closeWg sync.WaitGroup
history, unindexLimit uint64
noHistory bool
exportFileName string
Params
@ -191,7 +197,7 @@ func NewFilterMaps(db ethdb.KeyValueStore, initView *ChainView, params Params, c
finalBlockCh: make(chan uint64, 1),
blockProcessingCh: make(chan bool, 1),
history: config.History,
noHistory: config.Disabled,
disabled: config.Disabled,
exportFileName: config.ExportFileName,
Params: params,
indexedRange: filterMapsRange{

View file

@ -34,7 +34,7 @@ const (
func (f *FilterMaps) indexerLoop() {
defer f.closeWg.Done()
if f.noHistory {
if f.disabled {
f.reset()
return
}
@ -109,7 +109,7 @@ func (f *FilterMaps) SetBlockProcessing(blockProcessing bool) {
// WaitIdle blocks until the indexer is in an idle state while synced up to the
// latest targetView.
func (f *FilterMaps) WaitIdle() {
if f.noHistory {
if f.disabled {
f.closeWg.Wait()
return
}

View file

@ -418,7 +418,7 @@ func (tc *testChain) setHead(headNum int) {
func (tc *testChain) setTargetHead() {
head := tc.CurrentBlock()
if tc.ts.fm != nil {
if !tc.ts.fm.noHistory {
if !tc.ts.fm.disabled {
//tc.ts.fm.targetViewCh <- NewChainView(tc, head.Number.Uint64(), head.Hash())
tc.ts.fm.SetTargetView(NewChainView(tc, head.Number.Uint64(), head.Hash()))
}

View file

@ -155,7 +155,7 @@ func (fm *FilterMapsMatcherBackend) synced() {
// range that has not been changed and has been consistent with all states of the
// chain since the previous SyncLogIndex or the creation of the matcher backend.
func (fm *FilterMapsMatcherBackend) SyncLogIndex(ctx context.Context) (SyncRange, error) {
if fm.f.noHistory {
if fm.f.disabled {
return SyncRange{HeadNumber: fm.f.targetView.headNumber}, nil
}