mirror of https://github.com/status-im/op-geth.git
cmd, node: support different bootnodes, fix default light port
This commit is contained in:
parent
40976ea1a0
commit
3b3989de6a
|
@ -55,6 +55,8 @@ var (
|
||||||
utils.UnlockedAccountFlag,
|
utils.UnlockedAccountFlag,
|
||||||
utils.PasswordFileFlag,
|
utils.PasswordFileFlag,
|
||||||
utils.BootnodesFlag,
|
utils.BootnodesFlag,
|
||||||
|
utils.BootnodesV4Flag,
|
||||||
|
utils.BootnodesV5Flag,
|
||||||
utils.DataDirFlag,
|
utils.DataDirFlag,
|
||||||
utils.KeyStoreDirFlag,
|
utils.KeyStoreDirFlag,
|
||||||
utils.NoUSBFlag,
|
utils.NoUSBFlag,
|
||||||
|
|
|
@ -129,6 +129,8 @@ var AppHelpFlagGroups = []flagGroup{
|
||||||
Name: "NETWORKING",
|
Name: "NETWORKING",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
utils.BootnodesFlag,
|
utils.BootnodesFlag,
|
||||||
|
utils.BootnodesV4Flag,
|
||||||
|
utils.BootnodesV5Flag,
|
||||||
utils.ListenPortFlag,
|
utils.ListenPortFlag,
|
||||||
utils.MaxPeersFlag,
|
utils.MaxPeersFlag,
|
||||||
utils.MaxPendingPeersFlag,
|
utils.MaxPendingPeersFlag,
|
||||||
|
|
|
@ -360,7 +360,17 @@ var (
|
||||||
}
|
}
|
||||||
BootnodesFlag = cli.StringFlag{
|
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 (set v4+v5 instead for light servers)",
|
||||||
|
Value: "",
|
||||||
|
}
|
||||||
|
BootnodesV4Flag = cli.StringFlag{
|
||||||
|
Name: "bootnodesv4",
|
||||||
|
Usage: "Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes)",
|
||||||
|
Value: "",
|
||||||
|
}
|
||||||
|
BootnodesV5Flag = cli.StringFlag{
|
||||||
|
Name: "bootnodesv5",
|
||||||
|
Usage: "Comma separated enode URLs for P2P v5 discovery bootstrap (light server, light nodes)",
|
||||||
Value: "",
|
Value: "",
|
||||||
}
|
}
|
||||||
NodeKeyFileFlag = cli.StringFlag{
|
NodeKeyFileFlag = cli.StringFlag{
|
||||||
|
@ -469,8 +479,12 @@ func setNodeUserIdent(ctx *cli.Context, cfg *node.Config) {
|
||||||
func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
|
func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
|
||||||
urls := params.MainnetBootnodes
|
urls := params.MainnetBootnodes
|
||||||
switch {
|
switch {
|
||||||
case ctx.GlobalIsSet(BootnodesFlag.Name):
|
case ctx.GlobalIsSet(BootnodesFlag.Name) || ctx.GlobalIsSet(BootnodesV4Flag.Name):
|
||||||
urls = strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",")
|
if ctx.GlobalIsSet(BootnodesV4Flag.Name) {
|
||||||
|
urls = strings.Split(ctx.GlobalString(BootnodesV4Flag.Name), ",")
|
||||||
|
} else {
|
||||||
|
urls = strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",")
|
||||||
|
}
|
||||||
case ctx.GlobalBool(TestnetFlag.Name):
|
case ctx.GlobalBool(TestnetFlag.Name):
|
||||||
urls = params.TestnetBootnodes
|
urls = params.TestnetBootnodes
|
||||||
case ctx.GlobalBool(RinkebyFlag.Name):
|
case ctx.GlobalBool(RinkebyFlag.Name):
|
||||||
|
@ -493,8 +507,12 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
|
||||||
func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
|
func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
|
||||||
urls := params.DiscoveryV5Bootnodes
|
urls := params.DiscoveryV5Bootnodes
|
||||||
switch {
|
switch {
|
||||||
case ctx.GlobalIsSet(BootnodesFlag.Name):
|
case ctx.GlobalIsSet(BootnodesFlag.Name) || ctx.GlobalIsSet(BootnodesV5Flag.Name):
|
||||||
urls = strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",")
|
if ctx.GlobalIsSet(BootnodesV5Flag.Name) {
|
||||||
|
urls = strings.Split(ctx.GlobalString(BootnodesV5Flag.Name), ",")
|
||||||
|
} else {
|
||||||
|
urls = strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",")
|
||||||
|
}
|
||||||
case ctx.GlobalBool(RinkebyFlag.Name):
|
case ctx.GlobalBool(RinkebyFlag.Name):
|
||||||
urls = params.RinkebyV5Bootnodes
|
urls = params.RinkebyV5Bootnodes
|
||||||
case cfg.BootstrapNodesV5 != nil:
|
case cfg.BootstrapNodesV5 != nil:
|
||||||
|
@ -717,6 +735,7 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
|
||||||
// --dev mode can't use p2p networking.
|
// --dev mode can't use p2p networking.
|
||||||
cfg.MaxPeers = 0
|
cfg.MaxPeers = 0
|
||||||
cfg.ListenAddr = ":0"
|
cfg.ListenAddr = ":0"
|
||||||
|
cfg.DiscoveryV5Addr = ":0"
|
||||||
cfg.NoDiscovery = true
|
cfg.NoDiscovery = true
|
||||||
cfg.DiscoveryV5 = false
|
cfg.DiscoveryV5 = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,10 @@ var DefaultConfig = Config{
|
||||||
WSPort: DefaultWSPort,
|
WSPort: DefaultWSPort,
|
||||||
WSModules: []string{"net", "web3"},
|
WSModules: []string{"net", "web3"},
|
||||||
P2P: p2p.Config{
|
P2P: p2p.Config{
|
||||||
ListenAddr: ":30303",
|
ListenAddr: ":30303",
|
||||||
MaxPeers: 25,
|
DiscoveryV5Addr: ":30304",
|
||||||
NAT: nat.Any(),
|
MaxPeers: 25,
|
||||||
|
NAT: nat.Any(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue