@@ -95,6 +95,7 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightEthereum, error) {
9595 lesCommons : lesCommons {
9696 chainDb : chainDb ,
9797 config : config ,
98+ iConfig : light .DefaultClientIndexerConfig ,
9899 },
99100 chainConfig : chainConfig ,
100101 eventMux : ctx .EventMux ,
@@ -105,16 +106,16 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightEthereum, error) {
105106 shutdownChan : make (chan bool ),
106107 networkId : config .NetworkId ,
107108 bloomRequests : make (chan chan * bloombits.Retrieval ),
108- bloomIndexer : eth .NewBloomIndexer (chainDb , light . BloomTrieFrequency , light .HelperTrieConfirmations ),
109+ bloomIndexer : eth .NewBloomIndexer (chainDb , params . BloomBitsBlocksClient , params .HelperTrieConfirmations ),
109110 }
110111
111112 leth .relay = NewLesTxRelay (peers , leth .reqDist )
112113 leth .serverPool = newServerPool (chainDb , quitSync , & leth .wg )
113114 leth .retriever = newRetrieveManager (peers , leth .reqDist , leth .serverPool )
114115
115- leth .odr = NewLesOdr (chainDb , leth .retriever )
116- leth .chtIndexer = light .NewChtIndexer (chainDb , true , leth .odr )
117- leth .bloomTrieIndexer = light .NewBloomTrieIndexer (chainDb , true , leth .odr )
116+ leth .odr = NewLesOdr (chainDb , light . DefaultClientIndexerConfig , leth .retriever )
117+ leth .chtIndexer = light .NewChtIndexer (chainDb , leth .odr , params . CHTFrequencyClient , params . HelperTrieConfirmations )
118+ leth .bloomTrieIndexer = light .NewBloomTrieIndexer (chainDb , leth .odr , params . BloomBitsBlocksClient , params . BloomTrieFrequency )
118119 leth .odr .SetIndexers (leth .chtIndexer , leth .bloomTrieIndexer , leth .bloomIndexer )
119120
120121 // Note: NewLightChain adds the trusted checkpoint so it needs an ODR with
@@ -135,7 +136,7 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightEthereum, error) {
135136 }
136137
137138 leth .txPool = light .NewTxPool (leth .chainConfig , leth .blockchain , leth .relay )
138- if leth .protocolManager , err = NewProtocolManager (leth .chainConfig , true , config .NetworkId , leth .eventMux , leth .engine , leth .peers , leth .blockchain , nil , chainDb , leth .odr , leth .relay , leth .serverPool , quitSync , & leth .wg ); err != nil {
139+ if leth .protocolManager , err = NewProtocolManager (leth .chainConfig , light . DefaultClientIndexerConfig , true , config .NetworkId , leth .eventMux , leth .engine , leth .peers , leth .blockchain , nil , chainDb , leth .odr , leth .relay , leth .serverPool , quitSync , & leth .wg ); err != nil {
139140 return nil , err
140141 }
141142 leth .ApiBackend = & LesApiBackend {leth , nil }
@@ -230,8 +231,8 @@ func (s *LightEthereum) Protocols() []p2p.Protocol {
230231// Start implements node.Service, starting all internal goroutines needed by the
231232// Ethereum protocol implementation.
232233func (s * LightEthereum ) Start (srvr * p2p.Server ) error {
233- s .startBloomHandlers ()
234234 log .Warn ("Light client mode is an experimental feature" )
235+ s .startBloomHandlers (params .BloomBitsBlocksClient )
235236 s .netRPCService = ethapi .NewPublicNetAPI (srvr , s .networkId )
236237 // clients are searching for the first advertised protocol in the list
237238 protocolVersion := AdvertiseProtocolVersions [0 ]
0 commit comments