Browse Source

fix more compile errors

master
Jonathan "Duke" Leto 2 years ago
parent
commit
cfa284ffee
  1. 14
      cmd/server/main.go
  2. 8
      common/cache.go
  3. 4
      frontend/service.go

14
cmd/server/main.go

@ -212,13 +212,15 @@ func main() {
go common.BlockIngestor(rpcClient, cache, log, stopChan, cacheStart)
// Compact transaction service initialization
service, err := frontend.NewSQLiteStreamer(rpcClient, cache, log)
if err != nil {
log.WithFields(logrus.Fields{
"error": err,
}).Fatal("couldn't create SQL backend")
{
service, err := frontend.NewLwdStreamer(cache, chainName, opts.PingEnable)
if err != nil {
common.Log.WithFields(logrus.Fields{
"error": err,
}).Fatal("couldn't create backend")
}
walletrpc.RegisterCompactTxStreamerServer(server, service)
}
defer service.(*frontend.SqlStreamer).GracefulStop()
// Register service
walletrpc.RegisterCompactTxStreamerServer(server, service)

8
common/cache.go

@ -19,6 +19,7 @@ type BlockCache struct {
FirstBlock int
LastBlock int
NextBlock int // height of the first block not in the cache
latestHash []byte // hash of the most recent (highest height) block, for detecting reorgs.
m map[int]*BlockCacheEntry
@ -123,6 +124,13 @@ func (c *BlockCache) GetLatestHeight() int {
return c.NextBlock - 1
}
// GetLatestHash returns the hash (block ID) of the most recent (highest) known block.
func (c *BlockCache) GetLatestHash() []byte {
c.mutex.RLock()
defer c.mutex.RUnlock()
return c.latestHash
}
func (c *BlockCache) GetLatestBlock() int {
c.mutex.RLock()
defer c.mutex.RUnlock()

4
frontend/service.go

@ -47,10 +47,6 @@ type SqlStreamer struct {
log *logrus.Entry
}
func NewSQLiteStreamer(client *rpcclient.Client, cache *common.BlockCache, log *logrus.Entry) (walletrpc.CompactTxStreamerServer, error) {
return &SqlStreamer{cache, client, log}, nil
}
func (s *SqlStreamer) GracefulStop() error {
return nil
}

Loading…
Cancel
Save