diff options
author | Zsolt Felfoldi <zsfelfoldi@gmail.com> | 2017-08-19 03:52:20 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-09-06 16:13:13 +0800 |
commit | 4ea4d2dc3473afd9d2eda6ef6b359accce1f0946 (patch) | |
tree | e651cfc2e3aa36083b333bf34dc3cccef2623f26 /eth/backend.go | |
parent | 1e67378df879b1ce566f17dd95a3b126056254b5 (diff) | |
download | dexon-4ea4d2dc3473afd9d2eda6ef6b359accce1f0946.tar.gz dexon-4ea4d2dc3473afd9d2eda6ef6b359accce1f0946.tar.zst dexon-4ea4d2dc3473afd9d2eda6ef6b359accce1f0946.zip |
core, eth: add bloombit indexer, filter based on it
Diffstat (limited to 'eth/backend.go')
-rw-r--r-- | eth/backend.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/eth/backend.go b/eth/backend.go index 5837c8564..efc0a2317 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -77,6 +77,8 @@ type Ethereum struct { engine consensus.Engine accountManager *accounts.Manager + bbIndexer *core.ChainIndexer + ApiBackend *EthApiBackend miner *miner.Miner @@ -125,11 +127,9 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { networkId: config.NetworkId, gasPrice: config.GasPrice, etherbase: config.Etherbase, + bbIndexer: NewBloomBitsProcessor(chainDb, bloomBitsSection), } - if err := addMipmapBloomBins(chainDb); err != nil { - return nil, err - } log.Info("Initialising Ethereum protocol", "versions", ProtocolVersions, "network", config.NetworkId) if !config.SkipBcVersionCheck { @@ -151,6 +151,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { eth.blockchain.SetHead(compat.RewindTo) core.WriteChainConfig(chainDb, genesisHash, chainConfig) } + eth.bbIndexer.Start(eth.blockchain) if config.TxPool.Journal != "" { config.TxPool.Journal = ctx.ResolvePath(config.TxPool.Journal) @@ -260,7 +261,7 @@ func (s *Ethereum) APIs() []rpc.API { }, { Namespace: "eth", Version: "1.0", - Service: filters.NewPublicFilterAPI(s.ApiBackend, false), + Service: filters.NewPublicFilterAPI(s.ApiBackend, false, bloomBitsSection), Public: true, }, { Namespace: "admin", @@ -389,6 +390,7 @@ func (s *Ethereum) Stop() error { if s.stopDbUpgrade != nil { s.stopDbUpgrade() } + s.bbIndexer.Close() s.blockchain.Stop() s.protocolManager.Stop() if s.lesServer != nil { |