Hook CBF indexer to server code

This commit is contained in:
pedro martelletto 2017-01-12 11:20:16 +00:00 committed by Olaoluwa Osuntokun
parent 9809f4ffdd
commit 3b0038093a

View file

@ -229,6 +229,7 @@ type server struct {
// do not need to be protected for concurrent access.
txIndex *indexers.TxIndex
addrIndex *indexers.AddrIndex
cbfIndex *indexers.CBFIndex
}
// serverPeer extends the peer to maintain state shared by the server and
@ -2236,6 +2237,11 @@ func newServer(listenAddrs []string, db database.DB, chainParams *chaincfg.Param
s.addrIndex = indexers.NewAddrIndex(db, chainParams)
indexes = append(indexes, s.addrIndex)
}
if !cfg.NoCBFilters {
indxLog.Info("CBF index is enabled")
s.cbfIndex = indexers.NewCBFIndex(db)
indexes = append(indexes, s.cbfIndex)
}
// Create an index manager if any of the optional indexes are enabled.
var indexManager blockchain.IndexManager