erigon-pulse/cmd/erigon/main.go

41 lines
1.0 KiB
Go
Raw Normal View History

package main
import (
"fmt"
"os"
"github.com/ledgerwatch/erigon/common/debug"
"github.com/ledgerwatch/erigon/params"
erigoncli "github.com/ledgerwatch/erigon/turbo/cli"
"github.com/ledgerwatch/erigon/turbo/node"
2021-07-29 10:23:23 +00:00
"github.com/ledgerwatch/log/v3"
"github.com/urfave/cli"
)
func main() {
2021-06-22 10:09:45 +00:00
defer debug.LogPanic()
app := erigoncli.MakeApp(runErigon, erigoncli.DefaultFlags)
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
func runErigon(cliCtx *cli.Context) {
logger := log.New()
// initializing the node and providing the current git commit there
logger.Info("Build info", "git_branch", params.GitBranch, "git_tag", params.GitTag, "git_commit", params.GitCommit)
nodeCfg := node.NewNodConfigUrfave(cliCtx)
ethCfg := node.NewEthConfigUrfave(cliCtx, nodeCfg)
2021-07-31 05:24:20 +00:00
ethNode, err := node.New(nodeCfg, ethCfg, logger)
if err != nil {
2021-07-31 05:24:20 +00:00
log.Error("Erigon startup", "err", err)
return
}
err = ethNode.Serve()
if err != nil {
log.Error("error while serving an Erigon node", "err", err)
}
}