aboutsummaryrefslogtreecommitdiffstats
path: root/eth/api_backend.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-08-29 19:13:11 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-09-06 16:14:19 +0800
commitf585f9eee8cb18423c23fe8b517b5b4cbe3b3755 (patch)
tree08c232ee58318c20f971cf8e3f5dfa09f1e2caf7 /eth/api_backend.go
parent4ea4d2dc3473afd9d2eda6ef6b359accce1f0946 (diff)
downloaddexon-f585f9eee8cb18423c23fe8b517b5b4cbe3b3755.tar.gz
dexon-f585f9eee8cb18423c23fe8b517b5b4cbe3b3755.tar.zst
dexon-f585f9eee8cb18423c23fe8b517b5b4cbe3b3755.zip
core, eth: clean up bloom filtering, add some tests
Diffstat (limited to 'eth/api_backend.go')
-rw-r--r--eth/api_backend.go29
1 files changed, 7 insertions, 22 deletions
diff --git a/eth/api_backend.go b/eth/api_backend.go
index fa3cf3f80..91f392f94 100644
--- a/eth/api_backend.go
+++ b/eth/api_backend.go
@@ -24,11 +24,11 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/bloombits"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/downloader"
- "github.com/ethereum/go-ethereum/eth/filters"
"github.com/ethereum/go-ethereum/eth/gasprice"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
@@ -196,28 +196,13 @@ func (b *EthApiBackend) AccountManager() *accounts.Manager {
return b.eth.AccountManager()
}
-func (b *EthApiBackend) GetBloomBits(ctx context.Context, bitIdx uint64, sectionIdxList []uint64) ([][]byte, error) {
- results := make([][]byte, len(sectionIdxList))
- var err error
- for i, sectionIdx := range sectionIdxList {
- sectionHead := core.GetCanonicalHash(b.eth.chainDb, (sectionIdx+1)*bloomBitsSection-1)
- results[i], err = core.GetBloomBits(b.eth.chainDb, bitIdx, sectionIdx, sectionHead)
- if err != nil {
- return nil, err
- }
- }
- return results, nil
-}
-
-func (b *EthApiBackend) BloomBitsSections() uint64 {
- sections, _, _ := b.eth.bbIndexer.Sections()
- return sections
+func (b *EthApiBackend) BloomStatus() (uint64, uint64) {
+ sections, _, _ := b.eth.bloomIndexer.Sections()
+ return params.BloomBitsBlocks, sections
}
-func (b *EthApiBackend) BloomBitsConfig() filters.BloomConfig {
- return filters.BloomConfig{
- SectionSize: bloomBitsSection,
- MaxRequestLen: 16,
- MaxRequestWait: 0,
+func (b *EthApiBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) {
+ for i := 0; i < bloomFilterThreads; i++ {
+ go session.Multiplex(bloomRetrievalBatch, bloomRetrievalWait, b.eth.bloomRequests)
}
}