prysm-pulse/cmd/geth/shardingcmd.go
Preston Van Loon 60a5fc7f9b sharding: add debug flags to sharding (#218)
Former-commit-id: d5ae247e0cf4228f227b325812966ff3c0435a6f [formerly 288cbd8546d5d3715f5a948fc0d4a85851d8152b]
Former-commit-id: 27bb304720de6dc4a69603a5fae2917828a06ffc
2018-06-26 11:04:27 -05:00

44 lines
1.5 KiB
Go

package main
import (
"fmt"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/internal/debug"
node "github.com/ethereum/go-ethereum/sharding/node"
cli "gopkg.in/urfave/cli.v1"
)
var (
flags = []cli.Flag{utils.ActorFlag, utils.DataDirFlag, utils.PasswordFileFlag, utils.NetworkIdFlag, utils.IPCPathFlag, utils.DepositFlag, utils.ShardIDFlag}
shardingCommand = cli.Command{
Action: utils.MigrateFlags(shardingCmd),
Name: "sharding",
Usage: "Start a sharding-enabled node",
ArgsUsage: "[endpoint]",
Flags: append(flags, debug.Flags...),
Category: "SHARDING COMMANDS",
Description: `
Launches a sharding node that manages services related to submitting collations to a Sharding Manager Contract, notary and proposer services, and shardp2p connections. This feature is a work in progress.
`,
}
)
// shardingCmd is the main cmd line entry point for starting a sharding-enabled node.
// A sharding node launches a suite of services including notary services,
// proposer services, and a shardp2p protocol.
func shardingCmd(ctx *cli.Context) error {
if err := debug.Setup(ctx); err != nil {
return err
}
// configures a sharding-enabled node using the cli's context.
shardingNode, err := node.New(ctx)
if err != nil {
return fmt.Errorf("could not initialize sharding node instance: %v", err)
}
// starts a connection to a geth node and kicks off every registered service.
shardingNode.Start()
return nil
}