make Waku the default protocol

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-08-19 14:06:41 +02:00 committed by Jakub
parent 6fb5cd2154
commit ea47f07b96
2 changed files with 22 additions and 8 deletions

View File

@ -52,15 +52,15 @@ In order to adjust logging settings you'd need:
```
Valid `LogLevel` settings are: `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`
## `WhisperConfig`
## `WakuConfig`
If you want your node to relay Whisper(SHH) protocol messages you'll want to include this:
If you want your node to relay Waku(modified Whisper) protocol messages you'll want to include this:
```json
{
"WhisperConfig": {
"WakuConfig": {
"Enabled": true,
"EnableMailServer": true,
"LightClient": false,
"DataDir": "/tmp/status-go-data/waku",
"MailServerPassword": "status-offline-inbox"
}
}

View File

@ -20,6 +20,7 @@ import (
"github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/static"
wakucommon "github.com/status-im/status-go/waku/common"
"github.com/status-im/status-go/whisper/v6"
)
@ -584,7 +585,7 @@ func NewNodeConfigWithDefaults(dataDir string, networkID uint64, opts ...Option)
c.LogMaxBackups = 3
c.LogToStderr = true
c.EnableNTPSync = true
c.WhisperConfig.Enabled = true
c.WakuConfig.Enabled = true
for _, opt := range opts {
if err := opt(c); err != nil {
@ -666,13 +667,12 @@ func (c *NodeConfig) updatePeerLimits() {
// NewNodeConfig creates new node configuration object with bare-minimum defaults.
// Important: the returned config is not validated.
func NewNodeConfig(dataDir string, networkID uint64) (*NodeConfig, error) {
var keyStoreDir, wnodeDir string
var keyStoreDir, wnodeDir, wakuDir string
if dataDir != "" {
keyStoreDir = filepath.Join(dataDir, "keystore")
}
if dataDir != "" {
wnodeDir = filepath.Join(dataDir, "wnode")
wakuDir = filepath.Join(dataDir, "waku")
}
config := &NodeConfig{
@ -699,6 +699,12 @@ func NewNodeConfig(dataDir string, networkID uint64) (*NodeConfig, error) {
LightEthConfig: LightEthConfig{
DatabaseCache: 16,
},
WakuConfig: WakuConfig{
DataDir: wakuDir,
MinimumPoW: WakuMinimumPoW,
TTL: WakuTTL,
MaxMessageSize: wakucommon.DefaultMaxMessageSize,
},
WhisperConfig: WhisperConfig{
DataDir: wnodeDir,
MinimumPoW: WhisperMinimumPoW,
@ -804,6 +810,14 @@ func (c *NodeConfig) Validate() error {
}
}
// Waku's data directory must be relative to the main data directory
// if EnableMailServer is true.
if c.WakuConfig.Enabled && c.WakuConfig.EnableMailServer {
if !strings.HasPrefix(c.WakuConfig.DataDir, c.DataDir) {
return fmt.Errorf("WakuConfig.DataDir must start with DataDir fragment")
}
}
if !c.NoDiscovery && len(c.ClusterConfig.BootNodes) == 0 {
// No point in running discovery if we don't have bootnodes.
// In case we do have bootnodes, NoDiscovery should be true.