rpc: add indexers.CfIndex to config, utilize

This commit is contained in:
Olaoluwa Osuntokun 2017-08-24 16:30:34 -07:00
parent c8fdf8bf59
commit 5ab49ca22c

View file

@ -2156,7 +2156,7 @@ func handleGetCFilter(s *rpcServer, cmd interface{}, closeChan <-chan struct{})
return nil, rpcDecodeHexError(c.Hash)
}
filterBytes, err := s.server.cfIndex.FilterByBlockHash(hash, c.Extended)
filterBytes, err := s.cfg.CfIndex.FilterByBlockHash(hash, c.Extended)
if err != nil {
rpcsLog.Debugf("Could not find committed filter for %v: %v",
hash, err)
@ -2178,7 +2178,7 @@ func handleGetCFilterHeader(s *rpcServer, cmd interface{}, closeChan <-chan stru
return nil, rpcDecodeHexError(c.Hash)
}
headerBytes, err := s.server.cfIndex.FilterHeaderByBlockHash(hash, c.Extended)
headerBytes, err := s.cfg.CfIndex.FilterHeaderByBlockHash(hash, c.Extended)
if len(headerBytes) > 0 {
rpcsLog.Debugf("Found header of committed filter for %v", hash)
} else {
@ -4232,6 +4232,7 @@ type rpcserverConfig struct {
// of to provide additional data when queried.
TxIndex *indexers.TxIndex
AddrIndex *indexers.AddrIndex
CfIndex *indexers.CfIndex
}
// newRPCServer returns a new instance of the rpcServer struct.