Skip to content

Commit

Permalink
make node-canary working again (#1221)
Browse files Browse the repository at this point in the history
* removed fleet validation (no fleet is allowed)
  • Loading branch information
adambabik authored Oct 4, 2018
1 parent 5b551c6 commit fc54e0b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
3 changes: 1 addition & 2 deletions cmd/node-canary/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,9 @@ func makeNodeConfig() (*params.NodeConfig, error) {
}

nodeConfig.ListenAddr = ""
nodeConfig.NoDiscovery = true
if *staticEnodeAddr != "" {
nodeConfig.ClusterConfig.Enabled = true
nodeConfig.ClusterConfig.Fleet = "none"
nodeConfig.ClusterConfig.Fleet = params.FleetUndefined
nodeConfig.ClusterConfig.StaticNodes = []string{
*staticEnodeAddr,
}
Expand Down
19 changes: 10 additions & 9 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,21 @@ func (c *SwarmConfig) String() string {
// 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).
type ClusterConfig struct {
// Enabled flag specifies whether feature is enabled
// Enabled flag specifies that nodes in this configuration are taken into account.
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

// StaticNodes is a list of static nodes for this fleet.
// StaticNodes is a list of static nodes.
StaticNodes []string

// BootNodes is a list of cluster peer nodes for this fleet.
// BootNodes is a list of bootnodes.
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

// RendezvousNodes is a list rendezvous discovery nodes.
Expand Down Expand Up @@ -288,6 +290,7 @@ func WithFleet(fleet string) Option {
if fleet == FleetUndefined {
return nil
}
c.ClusterConfig.Enabled = true
return loadConfigFromAsset(fmt.Sprintf("../config/cli/fleet-%s.json", fleet), c)
}
}
Expand All @@ -314,6 +317,7 @@ func NewNodeConfigWithDefaults(dataDir string, networkID uint64, opts ...Option)
return nil, err
}

c.NoDiscovery = false
c.HTTPHost = ""
c.ListenAddr = ":30303"
c.LogEnabled = true
Expand Down Expand Up @@ -403,6 +407,7 @@ func NewNodeConfig(dataDir string, networkID uint64) (*NodeConfig, error) {
log: log.New("package", "status-go/params.NodeConfig"),
LogFile: "",
LogLevel: "ERROR",
NoDiscovery: true,
UpstreamConfig: UpstreamRPCConfig{
URL: getUpstreamURL(networkID),
},
Expand Down Expand Up @@ -567,10 +572,6 @@ func (c *ClusterConfig) Validate(validate *validator.Validate) error {
return err
}

if c.Fleet == "" {
return fmt.Errorf("ClusterConfig.Fleet is empty")
}

return nil
}

Expand Down
14 changes: 0 additions & 14 deletions params/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Config: `{
Expand Down

0 comments on commit fc54e0b

Please sign in to comment.