mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
core/filtermaps: rename noHistory field -> disabled
This commit is contained in:
parent
2131db4fd7
commit
664ac74484
4 changed files with 12 additions and 6 deletions
|
|
@ -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{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue