2020-09-06 11:35:32 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/ledgerwatch/turbo-geth/eth/stagedsync"
|
|
|
|
"github.com/ledgerwatch/turbo-geth/log"
|
|
|
|
"github.com/ledgerwatch/turbo-geth/turbo/node"
|
|
|
|
|
|
|
|
turbocli "github.com/ledgerwatch/turbo-geth/turbo/cli"
|
|
|
|
|
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2020-09-11 16:42:33 +00:00
|
|
|
gitCommit string
|
2020-09-06 11:35:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
app := turbocli.MakeApp(runTurboGeth, turbocli.DefaultFlags)
|
|
|
|
if err := app.Run(os.Args); err != nil {
|
|
|
|
fmt.Fprintln(os.Stderr, err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func runTurboGeth(ctx *cli.Context) {
|
|
|
|
sync := stagedsync.New(
|
|
|
|
stagedsync.DefaultStages(),
|
|
|
|
stagedsync.DefaultUnwindOrder(),
|
|
|
|
)
|
|
|
|
|
2020-09-11 16:42:33 +00:00
|
|
|
tg := node.New(ctx, sync, node.Params{GitCommit: gitCommit})
|
2020-09-06 11:35:32 +00:00
|
|
|
err := tg.Serve()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
log.Error("error while serving a turbo-geth node", "err", err)
|
|
|
|
}
|
|
|
|
}
|