Skip to content

Commit

Permalink
Add peer limits to CLI defaults (#1192)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Pombeiro authored Sep 14, 2018
1 parent 1ce6f44 commit 5b98b88
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,25 @@ func NewNodeConfigWithDefaults(dataDir, fleet string, networkID uint64) (*NodeCo
nodeConfig.WhisperConfig.Enabled = true
nodeConfig.WhisperConfig.EnableNTPSync = true

nodeConfig.updatePeerLimits()

return nodeConfig, nil
}

// updatePeerLimits will set default peer limits expectations based on enabled services.
func (c *NodeConfig) updatePeerLimits() {
if c.NoDiscovery && !c.Rendezvous {
return
}
if c.WhisperConfig.Enabled {
c.RequireTopics[WhisperDiscv5Topic] = WhisperDiscv5Limits
// TODO(dshulyak) register mailserver limits when we will change how they are handled.
}
if c.LightEthConfig.Enabled {
c.RequireTopics[discv5.Topic(LesTopic(int(c.NetworkID)))] = LesDiscoveryLimits
}
}

// NewNodeConfig creates new node configuration object with bare-minimum defaults
func NewNodeConfig(dataDir, fleet string, networkID uint64) (*NodeConfig, error) {
nodeConfig := &NodeConfig{
Expand Down

0 comments on commit 5b98b88

Please sign in to comment.