mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-15 15:28:19 +00:00
0c91bfbf3e
* clean * save * pubsub * pubsub * pubsub * pubsub * pubsub * pubsub * save * tx pub-sub * tx pub-sub * clean * clean * save * save * save * save * save * Squashed 'interfaces/' content from commit c469f3ae0 git-subtree-dir: interfaces git-subtree-split: c469f3ae073b60c8821b61fed2910191080ef835 * save * save * save * save * Squashed 'interfaces/' changes from c469f3ae0..958dfc669 958dfc669 save git-subtree-dir: interfaces git-subtree-split: 958dfc669f8daeefe686a13aa852fb95f1537886 * save * save * up some deps * up some deps * clean * test * test * test * test * test * test * test * test * test * test * test * test
58 lines
1.5 KiB
Go
58 lines
1.5 KiB
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/common/fdlimit"
|
|
"github.com/ledgerwatch/turbo-geth/log"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func main() {
|
|
raiseFdLimit()
|
|
cmd, cfg := cli.RootCommand()
|
|
rootCtx, rootCancel := utils.RootContext()
|
|
cmd.RunE = func(cmd *cobra.Command, args []string) error {
|
|
db, backend, txPool, mining, err := cli.RemoteServices(*cfg, rootCancel)
|
|
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(rootCtx, backend, txPool, mining)
|
|
} else {
|
|
log.Info("filters are not supported in chaindata mode")
|
|
}
|
|
|
|
if err := cli.StartRpcServer(cmd.Context(), *cfg, commands.APIList(cmd.Context(), db, backend, txPool, mining, ff, *cfg, nil)); err != nil {
|
|
log.Error(err.Error())
|
|
return nil
|
|
}
|
|
return nil
|
|
}
|
|
|
|
if err := cmd.ExecuteContext(rootCtx); err != nil {
|
|
log.Error(err.Error())
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
// raiseFdLimit raises out the number of allowed file handles per process
|
|
func raiseFdLimit() {
|
|
limit, err := fdlimit.Maximum()
|
|
if err != nil {
|
|
log.Error("Failed to retrieve file descriptor allowance", "error", err)
|
|
return
|
|
}
|
|
if _, err = fdlimit.Raise(uint64(limit)); err != nil {
|
|
log.Error("Failed to raise file descriptor allowance", "error", err)
|
|
}
|
|
}
|