Merge pull request #3548 from fjl/geth-fix-bootnodes

cmd/utils: fix comma-separated --bootnodes
This commit is contained in:
Péter Szilágyi 2017-01-11 10:59:14 +02:00 committed by GitHub
commit 2b4d0b6ff9

View File

@ -337,10 +337,10 @@ var (
Usage: "Network listening port", Usage: "Network listening port",
Value: 30303, Value: 30303,
} }
BootnodesFlag = cli.StringSliceFlag{ BootnodesFlag = cli.StringFlag{
Name: "bootnodes", Name: "bootnodes",
Usage: "Comma separated enode URLs for P2P discovery bootstrap", Usage: "Comma separated enode URLs for P2P discovery bootstrap",
Value: nil, Value: "",
} }
NodeKeyFileFlag = cli.StringFlag{ NodeKeyFileFlag = cli.StringFlag{
Name: "nodekey", Name: "nodekey",
@ -487,7 +487,7 @@ func makeNodeUserIdent(ctx *cli.Context) string {
func MakeBootstrapNodes(ctx *cli.Context) []*discover.Node { func MakeBootstrapNodes(ctx *cli.Context) []*discover.Node {
urls := params.MainnetBootnodes urls := params.MainnetBootnodes
if ctx.GlobalIsSet(BootnodesFlag.Name) { if ctx.GlobalIsSet(BootnodesFlag.Name) {
urls = ctx.GlobalStringSlice(BootnodesFlag.Name) urls = strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",")
} else if ctx.GlobalBool(TestNetFlag.Name) { } else if ctx.GlobalBool(TestNetFlag.Name) {
urls = params.TestnetBootnodes urls = params.TestnetBootnodes
} }
@ -509,7 +509,7 @@ func MakeBootstrapNodes(ctx *cli.Context) []*discover.Node {
func MakeBootstrapNodesV5(ctx *cli.Context) []*discv5.Node { func MakeBootstrapNodesV5(ctx *cli.Context) []*discv5.Node {
urls := params.DiscoveryV5Bootnodes urls := params.DiscoveryV5Bootnodes
if ctx.GlobalIsSet(BootnodesFlag.Name) { if ctx.GlobalIsSet(BootnodesFlag.Name) {
urls = ctx.GlobalStringSlice(BootnodesFlag.Name) urls = strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",")
} }
bootnodes := make([]*discv5.Node, 0, len(urls)) bootnodes := make([]*discv5.Node, 0, len(urls))