mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +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
|
// FilterMaps is the in-memory representation of the log index structure that is
|
||||||
// responsible for building and updating the index according to the canonical
|
// responsible for building and updating the index according to the canonical
|
||||||
// chain.
|
// chain.
|
||||||
|
//
|
||||||
// Note that FilterMaps implements the same data structure as proposed in EIP-7745
|
// Note that FilterMaps implements the same data structure as proposed in EIP-7745
|
||||||
// without the tree hashing and consensus changes:
|
// without the tree hashing and consensus changes:
|
||||||
// https://eips.ethereum.org/EIPS/eip-7745
|
// https://eips.ethereum.org/EIPS/eip-7745
|
||||||
type FilterMaps struct {
|
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{}
|
closeCh chan struct{}
|
||||||
closeWg sync.WaitGroup
|
closeWg sync.WaitGroup
|
||||||
history, unindexLimit uint64
|
history, unindexLimit uint64
|
||||||
noHistory bool
|
|
||||||
exportFileName string
|
exportFileName string
|
||||||
Params
|
Params
|
||||||
|
|
||||||
|
|
@ -191,7 +197,7 @@ func NewFilterMaps(db ethdb.KeyValueStore, initView *ChainView, params Params, c
|
||||||
finalBlockCh: make(chan uint64, 1),
|
finalBlockCh: make(chan uint64, 1),
|
||||||
blockProcessingCh: make(chan bool, 1),
|
blockProcessingCh: make(chan bool, 1),
|
||||||
history: config.History,
|
history: config.History,
|
||||||
noHistory: config.Disabled,
|
disabled: config.Disabled,
|
||||||
exportFileName: config.ExportFileName,
|
exportFileName: config.ExportFileName,
|
||||||
Params: params,
|
Params: params,
|
||||||
indexedRange: filterMapsRange{
|
indexedRange: filterMapsRange{
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ const (
|
||||||
func (f *FilterMaps) indexerLoop() {
|
func (f *FilterMaps) indexerLoop() {
|
||||||
defer f.closeWg.Done()
|
defer f.closeWg.Done()
|
||||||
|
|
||||||
if f.noHistory {
|
if f.disabled {
|
||||||
f.reset()
|
f.reset()
|
||||||
return
|
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
|
// WaitIdle blocks until the indexer is in an idle state while synced up to the
|
||||||
// latest targetView.
|
// latest targetView.
|
||||||
func (f *FilterMaps) WaitIdle() {
|
func (f *FilterMaps) WaitIdle() {
|
||||||
if f.noHistory {
|
if f.disabled {
|
||||||
f.closeWg.Wait()
|
f.closeWg.Wait()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -418,7 +418,7 @@ func (tc *testChain) setHead(headNum int) {
|
||||||
func (tc *testChain) setTargetHead() {
|
func (tc *testChain) setTargetHead() {
|
||||||
head := tc.CurrentBlock()
|
head := tc.CurrentBlock()
|
||||||
if tc.ts.fm != nil {
|
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.targetViewCh <- NewChainView(tc, head.Number.Uint64(), head.Hash())
|
||||||
tc.ts.fm.SetTargetView(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
|
// 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.
|
// chain since the previous SyncLogIndex or the creation of the matcher backend.
|
||||||
func (fm *FilterMapsMatcherBackend) SyncLogIndex(ctx context.Context) (SyncRange, error) {
|
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
|
return SyncRange{HeadNumber: fm.f.targetView.headNumber}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue