mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
eth/filters: fixed errors after rebase
This commit is contained in:
parent
c27586d55a
commit
0ca476b13f
3 changed files with 20 additions and 14 deletions
|
|
@ -248,7 +248,9 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
eth.bloomIndexer.Start(eth.blockchain)
|
eth.bloomIndexer.Start(eth.blockchain)
|
||||||
eth.filterMaps = filtermaps.NewFilterMaps(chainDb, eth.newChainView(eth.blockchain.CurrentBlock()), filtermaps.DefaultParams, config.LogHistory, 1000, config.LogNoHistory, config.LogExportCheckpoints)
|
fmConfig := filtermaps.Config{History: config.LogHistory, Disabled: config.LogNoHistory, ExportFileName: config.LogExportCheckpoints}
|
||||||
|
chainView := eth.newChainView(eth.blockchain.CurrentBlock())
|
||||||
|
eth.filterMaps = filtermaps.NewFilterMaps(chainDb, chainView, 0, 0, filtermaps.DefaultParams, fmConfig)
|
||||||
eth.closeFilterMaps = make(chan chan struct{})
|
eth.closeFilterMaps = make(chan chan struct{})
|
||||||
|
|
||||||
if config.BlobPool.Datadir != "" {
|
if config.BlobPool.Datadir != "" {
|
||||||
|
|
@ -436,25 +438,23 @@ func (s *Ethereum) updateFilterMapsHeads() {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
head := s.blockchain.CurrentBlock()
|
var head *types.Header
|
||||||
s.filterMaps.SetTargetView(s.newChainView(head))
|
|
||||||
var lastFinalBlock uint64
|
|
||||||
|
|
||||||
setHead := func(newHead *types.Header) {
|
setHead := func(newHead *types.Header) {
|
||||||
if newHead == nil {
|
if newHead == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if head == nil || newHead.Hash() != head.Hash() {
|
if head == nil || newHead.Hash() != head.Hash() {
|
||||||
head = newHead
|
head = newHead
|
||||||
s.filterMaps.SetTargetView(s.newChainView(head))
|
chainView := s.newChainView(head)
|
||||||
}
|
historyCutoff := s.blockchain.HistoryPruningCutoff()
|
||||||
|
var finalBlock uint64
|
||||||
if fb := s.blockchain.CurrentFinalBlock(); fb != nil {
|
if fb := s.blockchain.CurrentFinalBlock(); fb != nil {
|
||||||
if finalBlock := fb.Number.Uint64(); finalBlock != lastFinalBlock {
|
finalBlock = fb.Number.Uint64()
|
||||||
s.filterMaps.SetFinalBlock(finalBlock)
|
}
|
||||||
lastFinalBlock = finalBlock
|
s.filterMaps.SetTarget(chainView, historyCutoff, finalBlock)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setHead(s.blockchain.CurrentBlock())
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
|
|
||||||
|
|
@ -158,9 +158,15 @@ func (b *testBackend) NewMatcherBackend() filtermaps.MatcherBackend {
|
||||||
return b.fm.NewMatcherBackend()
|
return b.fm.NewMatcherBackend()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *testBackend) startFilterMaps(history uint64, noHistory bool, params filtermaps.Params) {
|
func (b *testBackend) startFilterMaps(history uint64, disabled bool, params filtermaps.Params) {
|
||||||
head := b.CurrentBlock()
|
head := b.CurrentBlock()
|
||||||
b.fm = filtermaps.NewFilterMaps(b.db, filtermaps.NewChainView(b, head.Number.Uint64(), head.Hash()), params, history, 1, noHistory, "")
|
chainView := filtermaps.NewChainView(b, head.Number.Uint64(), head.Hash())
|
||||||
|
config := filtermaps.Config{
|
||||||
|
History: history,
|
||||||
|
Disabled: disabled,
|
||||||
|
ExportFileName: "",
|
||||||
|
}
|
||||||
|
b.fm = filtermaps.NewFilterMaps(b.db, chainView, 0, 0, params, config)
|
||||||
b.fm.Start()
|
b.fm.Start()
|
||||||
b.fm.WaitIdle()
|
b.fm.WaitIdle()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -476,7 +476,7 @@ func TestRangeLogs(t *testing.T) {
|
||||||
|
|
||||||
updateHead := func() {
|
updateHead := func() {
|
||||||
head := bc.CurrentBlock()
|
head := bc.CurrentBlock()
|
||||||
backend.fm.SetTargetView(filtermaps.NewChainView(backend, head.Number.Uint64(), head.Hash()))
|
backend.fm.SetTarget(filtermaps.NewChainView(backend, head.Number.Uint64(), head.Hash()), 0, 0)
|
||||||
backend.fm.WaitIdle()
|
backend.fm.WaitIdle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue