make node-canary working again (#1221)
* removed fleet validation (no fleet is allowed)
This commit is contained in:
parent
5b551c67fa
commit
fc54e0b06c
|
@ -254,10 +254,9 @@ func makeNodeConfig() (*params.NodeConfig, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeConfig.ListenAddr = ""
|
nodeConfig.ListenAddr = ""
|
||||||
nodeConfig.NoDiscovery = true
|
|
||||||
if *staticEnodeAddr != "" {
|
if *staticEnodeAddr != "" {
|
||||||
nodeConfig.ClusterConfig.Enabled = true
|
nodeConfig.ClusterConfig.Enabled = true
|
||||||
nodeConfig.ClusterConfig.Fleet = "none"
|
nodeConfig.ClusterConfig.Fleet = params.FleetUndefined
|
||||||
nodeConfig.ClusterConfig.StaticNodes = []string{
|
nodeConfig.ClusterConfig.StaticNodes = []string{
|
||||||
*staticEnodeAddr,
|
*staticEnodeAddr,
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,19 +104,21 @@ func (c *SwarmConfig) String() string {
|
||||||
// means for mobile devices to get connected to Ethereum network (UDP-based discovery
|
// means for mobile devices to get connected to Ethereum network (UDP-based discovery
|
||||||
// may not be available, so we need means to discover the network manually).
|
// may not be available, so we need means to discover the network manually).
|
||||||
type ClusterConfig struct {
|
type ClusterConfig struct {
|
||||||
// Enabled flag specifies whether feature is enabled
|
// Enabled flag specifies that nodes in this configuration are taken into account.
|
||||||
Enabled bool
|
Enabled bool
|
||||||
|
|
||||||
// Fleet is a type of selected fleet.
|
// Fleet is a name of a selected fleet. If it has a value, nodes are loaded
|
||||||
|
// from a file, namely `fleet-*.{{ .Fleet }}.json`. Nodes can be added to any list
|
||||||
|
// in `ClusterConfig`.
|
||||||
Fleet string
|
Fleet string
|
||||||
|
|
||||||
// StaticNodes is a list of static nodes for this fleet.
|
// StaticNodes is a list of static nodes.
|
||||||
StaticNodes []string
|
StaticNodes []string
|
||||||
|
|
||||||
// BootNodes is a list of cluster peer nodes for this fleet.
|
// BootNodes is a list of bootnodes.
|
||||||
BootNodes []string
|
BootNodes []string
|
||||||
|
|
||||||
// TrustedMailServers is a list of verified Mail Servers for this fleet.
|
// TrustedMailServers is a list of verified and trusted Mail Server nodes.
|
||||||
TrustedMailServers []string
|
TrustedMailServers []string
|
||||||
|
|
||||||
// RendezvousNodes is a list rendezvous discovery nodes.
|
// RendezvousNodes is a list rendezvous discovery nodes.
|
||||||
|
@ -288,6 +290,7 @@ func WithFleet(fleet string) Option {
|
||||||
if fleet == FleetUndefined {
|
if fleet == FleetUndefined {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
c.ClusterConfig.Enabled = true
|
||||||
return loadConfigFromAsset(fmt.Sprintf("../config/cli/fleet-%s.json", fleet), c)
|
return loadConfigFromAsset(fmt.Sprintf("../config/cli/fleet-%s.json", fleet), c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -314,6 +317,7 @@ func NewNodeConfigWithDefaults(dataDir string, networkID uint64, opts ...Option)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.NoDiscovery = false
|
||||||
c.HTTPHost = ""
|
c.HTTPHost = ""
|
||||||
c.ListenAddr = ":30303"
|
c.ListenAddr = ":30303"
|
||||||
c.LogEnabled = true
|
c.LogEnabled = true
|
||||||
|
@ -403,6 +407,7 @@ func NewNodeConfig(dataDir string, networkID uint64) (*NodeConfig, error) {
|
||||||
log: log.New("package", "status-go/params.NodeConfig"),
|
log: log.New("package", "status-go/params.NodeConfig"),
|
||||||
LogFile: "",
|
LogFile: "",
|
||||||
LogLevel: "ERROR",
|
LogLevel: "ERROR",
|
||||||
|
NoDiscovery: true,
|
||||||
UpstreamConfig: UpstreamRPCConfig{
|
UpstreamConfig: UpstreamRPCConfig{
|
||||||
URL: getUpstreamURL(networkID),
|
URL: getUpstreamURL(networkID),
|
||||||
},
|
},
|
||||||
|
@ -567,10 +572,6 @@ func (c *ClusterConfig) Validate(validate *validator.Validate) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Fleet == "" {
|
|
||||||
return fmt.Errorf("ClusterConfig.Fleet is empty")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,20 +196,6 @@ func TestNodeConfigValidate(t *testing.T) {
|
||||||
}
|
}
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: "Validate that ClusterConfig.Fleet is verified to not be empty if ClusterConfig is enabled",
|
|
||||||
Config: `{
|
|
||||||
"NetworkId": 1,
|
|
||||||
"DataDir": "/some/dir",
|
|
||||||
"BackupDisabledDataDir": "/some/dir",
|
|
||||||
"KeyStoreDir": "/some/dir",
|
|
||||||
"NoDiscovery": true,
|
|
||||||
"ClusterConfig": {
|
|
||||||
"Enabled": true
|
|
||||||
}
|
|
||||||
}`,
|
|
||||||
Error: "ClusterConfig.Fleet is empty",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Name: "Validate that ClusterConfig.BootNodes is verified to not be empty if discovery is disabled",
|
Name: "Validate that ClusterConfig.BootNodes is verified to not be empty if discovery is disabled",
|
||||||
Config: `{
|
Config: `{
|
||||||
|
|
Loading…
Reference in New Issue