Commit c33e8084 authored by Adrian Sutton's avatar Adrian Sutton

op-node: Default to no netrestrict instead of allow none

When p2p.netrestrict was not set, the empty string was being used as the list of allowed nodes, thus preventing any peers from connecting.
parent 8b9acddf
...@@ -156,7 +156,6 @@ var ( ...@@ -156,7 +156,6 @@ var (
Name: "p2p.netrestrict", Name: "p2p.netrestrict",
Usage: "Comma-separated list of CIDR masks. P2P will only try to connect on these networks", Usage: "Comma-separated list of CIDR masks. P2P will only try to connect on these networks",
Required: false, Required: false,
Value: "",
EnvVars: p2pEnv("NETRESTRICT"), EnvVars: p2pEnv("NETRESTRICT"),
} }
HostMux = &cli.StringFlag{ HostMux = &cli.StringFlag{
......
...@@ -194,13 +194,14 @@ func loadDiscoveryOpts(conf *p2p.Config, ctx *cli.Context) error { ...@@ -194,13 +194,14 @@ func loadDiscoveryOpts(conf *p2p.Config, ctx *cli.Context) error {
conf.Bootnodes = p2p.DefaultBootnodes conf.Bootnodes = p2p.DefaultBootnodes
} }
netRestrict, err := netutil.ParseNetlist(ctx.String(flags.NetRestrict.Name)) if ctx.IsSet(flags.NetRestrict.Name) {
if err != nil { netRestrict, err := netutil.ParseNetlist(ctx.String(flags.NetRestrict.Name))
return fmt.Errorf("failed to parse net list: %w", err) if err != nil {
return fmt.Errorf("failed to parse net list: %w", err)
}
conf.NetRestrict = netRestrict
} }
conf.NetRestrict = netRestrict
return nil return nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment