@@ -337,10 +337,10 @@ var (
337
337
Usage : "Network listening port" ,
338
338
Value : 30303 ,
339
339
}
340
- BootnodesFlag = cli.StringFlag {
340
+ BootnodesFlag = cli.StringSliceFlag {
341
341
Name : "bootnodes" ,
342
342
Usage : "Comma separated enode URLs for P2P discovery bootstrap" ,
343
- Value : "" ,
343
+ Value : nil ,
344
344
}
345
345
NodeKeyFileFlag = cli.StringFlag {
346
346
Name : "nodekey" ,
@@ -485,17 +485,15 @@ func makeNodeUserIdent(ctx *cli.Context) string {
485
485
// MakeBootstrapNodes creates a list of bootstrap nodes from the command line
486
486
// flags, reverting to pre-configured ones if none have been specified.
487
487
func MakeBootstrapNodes (ctx * cli.Context ) []* discover.Node {
488
- // Return pre-configured nodes if none were manually requested
489
- if ! ctx .GlobalIsSet (BootnodesFlag .Name ) {
490
- if ctx .GlobalBool (TestNetFlag .Name ) {
491
- return params .TestnetBootnodes
492
- }
493
- return params .MainnetBootnodes
488
+ urls := params .MainnetBootnodes
489
+ if ctx .GlobalIsSet (BootnodesFlag .Name ) {
490
+ urls = ctx .GlobalStringSlice (BootnodesFlag .Name )
491
+ } else if ctx .GlobalBool (TestNetFlag .Name ) {
492
+ urls = params .TestnetBootnodes
494
493
}
495
- // Otherwise parse and use the CLI bootstrap nodes
496
- bootnodes := []* discover.Node {}
497
494
498
- for _ , url := range strings .Split (ctx .GlobalString (BootnodesFlag .Name ), "," ) {
495
+ bootnodes := make ([]* discover.Node , 0 , len (urls ))
496
+ for _ , url := range urls {
499
497
node , err := discover .ParseNode (url )
500
498
if err != nil {
501
499
glog .V (logger .Error ).Infof ("Bootstrap URL %s: %v\n " , url , err )
@@ -509,14 +507,13 @@ func MakeBootstrapNodes(ctx *cli.Context) []*discover.Node {
509
507
// MakeBootstrapNodesV5 creates a list of bootstrap nodes from the command line
510
508
// flags, reverting to pre-configured ones if none have been specified.
511
509
func MakeBootstrapNodesV5 (ctx * cli.Context ) []* discv5.Node {
512
- // Return pre-configured nodes if none were manually requested
513
- if ! ctx .GlobalIsSet (BootnodesFlag .Name ) {
514
- return params . DiscoveryV5Bootnodes
510
+ urls := params . DiscoveryV5Bootnodes
511
+ if ctx .GlobalIsSet (BootnodesFlag .Name ) {
512
+ urls = ctx . GlobalStringSlice ( BootnodesFlag . Name )
515
513
}
516
- // Otherwise parse and use the CLI bootstrap nodes
517
- bootnodes := []* discv5.Node {}
518
514
519
- for _ , url := range strings .Split (ctx .GlobalString (BootnodesFlag .Name ), "," ) {
515
+ bootnodes := make ([]* discv5.Node , 0 , len (urls ))
516
+ for _ , url := range urls {
520
517
node , err := discv5 .ParseNode (url )
521
518
if err != nil {
522
519
glog .V (logger .Error ).Infof ("Bootstrap URL %s: %v\n " , url , err )
0 commit comments