erigon-pulse/cmd/rpcdaemon/main.go
Igor Mandrigin 393c9965ae
rpcdaemon: subscriptions, newHeads (#1359)
* fix `make grpc` on new checkouts

* update proto files

* add some stub

* prototype with fake events

* notifying about events

* pass events

* events are being sent

* transfer headers to filters

* create the “filters” struct

* implement new heads

* PoC of New Heads subscription

* fix keep alive

* fixups for the client

* add “type” to the event

* support header event type on client

* better stage refactor

* fixup for the eth backend

* fixups

* fix tests

* fix tests

* fix linters

* address comments

* remove unused log
2020-11-17 19:13:41 +00:00

39 lines
934 B
Go

package main
import (
"os"
"github.com/ledgerwatch/turbo-geth/cmd/rpcdaemon/cli"
"github.com/ledgerwatch/turbo-geth/cmd/rpcdaemon/commands"
"github.com/ledgerwatch/turbo-geth/cmd/rpcdaemon/filters"
"github.com/ledgerwatch/turbo-geth/cmd/utils"
"github.com/ledgerwatch/turbo-geth/log"
"github.com/spf13/cobra"
)
func main() {
cmd, cfg := cli.RootCommand()
cmd.RunE = func(cmd *cobra.Command, args []string) error {
db, backend, err := cli.OpenDB(*cfg)
if err != nil {
log.Error("Could not connect to DB", "error", err)
return nil
}
defer db.Close()
var ff *filters.Filters
if backend != nil {
ff = filters.New(backend)
} else {
log.Info("filters are not supported in chaindata mode")
}
return cli.StartRpcServer(cmd.Context(), *cfg, commands.APIList(db, backend, ff, *cfg, nil))
}
if err := cmd.ExecuteContext(utils.RootContext()); err != nil {
log.Error(err.Error())
os.Exit(1)
}
}