aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-01-06 21:42:03 +0800
committerGitHub <noreply@github.com>2017-01-06 21:42:03 +0800
commit8f9daaa3ba71c3b6bdcc24adfdc987e6f3a2e184 (patch)
tree92a336065bddcd620798e8f552432e3ed62ee14a /cmd
parente0ee0cc66a4416edd47232649f4d4bca4a5e3c07 (diff)
parentd3b751e4d94f95f6cc89544852f2d5811e075665 (diff)
downloaddexon-8f9daaa3ba71c3b6bdcc24adfdc987e6f3a2e184.tar
dexon-8f9daaa3ba71c3b6bdcc24adfdc987e6f3a2e184.tar.gz
dexon-8f9daaa3ba71c3b6bdcc24adfdc987e6f3a2e184.tar.bz2
dexon-8f9daaa3ba71c3b6bdcc24adfdc987e6f3a2e184.tar.lz
dexon-8f9daaa3ba71c3b6bdcc24adfdc987e6f3a2e184.tar.xz
dexon-8f9daaa3ba71c3b6bdcc24adfdc987e6f3a2e184.tar.zst
dexon-8f9daaa3ba71c3b6bdcc24adfdc987e6f3a2e184.zip
Merge pull request #3518 from fjl/ethclient-dependency-cleanup
core/types: dependency cleanup
Diffstat (limited to 'cmd')
-rw-r--r--cmd/disasm/main.go2
-rw-r--r--cmd/utils/flags.go31
2 files changed, 15 insertions, 18 deletions
diff --git a/cmd/disasm/main.go b/cmd/disasm/main.go
index d792e8ee5..41cad0231 100644
--- a/cmd/disasm/main.go
+++ b/cmd/disasm/main.go
@@ -18,10 +18,10 @@
package main
import (
+ "encoding/hex"
"fmt"
"io/ioutil"
"os"
- "encoding/hex"
"strings"
"github.com/ethereum/go-ethereum/core/vm"
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index c5f38fe93..18745e557 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -337,10 +337,10 @@ var (
Usage: "Network listening port",
Value: 30303,
}
- BootnodesFlag = cli.StringFlag{
+ BootnodesFlag = cli.StringSliceFlag{
Name: "bootnodes",
Usage: "Comma separated enode URLs for P2P discovery bootstrap",
- Value: "",
+ Value: nil,
}
NodeKeyFileFlag = cli.StringFlag{
Name: "nodekey",
@@ -485,17 +485,15 @@ func makeNodeUserIdent(ctx *cli.Context) string {
// MakeBootstrapNodes creates a list of bootstrap nodes from the command line
// flags, reverting to pre-configured ones if none have been specified.
func MakeBootstrapNodes(ctx *cli.Context) []*discover.Node {
- // Return pre-configured nodes if none were manually requested
- if !ctx.GlobalIsSet(BootnodesFlag.Name) {
- if ctx.GlobalBool(TestNetFlag.Name) {
- return params.TestnetBootnodes
- }
- return params.MainnetBootnodes
+ urls := params.MainnetBootnodes
+ if ctx.GlobalIsSet(BootnodesFlag.Name) {
+ urls = ctx.GlobalStringSlice(BootnodesFlag.Name)
+ } else if ctx.GlobalBool(TestNetFlag.Name) {
+ urls = params.TestnetBootnodes
}
- // Otherwise parse and use the CLI bootstrap nodes
- bootnodes := []*discover.Node{}
- for _, url := range strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",") {
+ bootnodes := make([]*discover.Node, 0, len(urls))
+ for _, url := range urls {
node, err := discover.ParseNode(url)
if err != nil {
glog.V(logger.Error).Infof("Bootstrap URL %s: %v\n", url, err)
@@ -509,14 +507,13 @@ func MakeBootstrapNodes(ctx *cli.Context) []*discover.Node {
// MakeBootstrapNodesV5 creates a list of bootstrap nodes from the command line
// flags, reverting to pre-configured ones if none have been specified.
func MakeBootstrapNodesV5(ctx *cli.Context) []*discv5.Node {
- // Return pre-configured nodes if none were manually requested
- if !ctx.GlobalIsSet(BootnodesFlag.Name) {
- return params.DiscoveryV5Bootnodes
+ urls := params.DiscoveryV5Bootnodes
+ if ctx.GlobalIsSet(BootnodesFlag.Name) {
+ urls = ctx.GlobalStringSlice(BootnodesFlag.Name)
}
- // Otherwise parse and use the CLI bootstrap nodes
- bootnodes := []*discv5.Node{}
- for _, url := range strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",") {
+ bootnodes := make([]*discv5.Node, 0, len(urls))
+ for _, url := range urls {
node, err := discv5.ParseNode(url)
if err != nil {
glog.V(logger.Error).Infof("Bootstrap URL %s: %v\n", url, err)