2018-03-02 10:25:30 +01:00
|
|
|
package node
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2019-08-20 18:38:40 +03:00
|
|
|
"github.com/ethereum/go-ethereum/accounts"
|
2018-03-02 10:25:30 +01:00
|
|
|
|
2020-01-02 10:10:19 +01:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
2018-06-08 13:29:50 +02:00
|
|
|
"github.com/status-im/status-go/params"
|
2018-03-02 10:25:30 +01:00
|
|
|
)
|
|
|
|
|
2021-05-14 12:55:42 +02:00
|
|
|
func TestWakuLightModeEnabledSetsEmptyBloomFilter(t *testing.T) {
|
2018-04-16 14:36:09 +02:00
|
|
|
config := params.NodeConfig{
|
2020-01-08 12:12:23 +01:00
|
|
|
EnableNTPSync: true,
|
2021-05-14 12:55:42 +02:00
|
|
|
WakuConfig: params.WakuConfig{
|
2018-04-16 14:36:09 +02:00
|
|
|
Enabled: true,
|
|
|
|
LightClient: true,
|
|
|
|
},
|
|
|
|
}
|
2021-12-21 15:44:37 +00:00
|
|
|
node := New(nil)
|
2019-08-20 18:38:40 +03:00
|
|
|
require.NoError(t, node.Start(&config, &accounts.Manager{}))
|
2018-03-02 10:25:30 +01:00
|
|
|
defer func() {
|
2018-04-16 14:36:09 +02:00
|
|
|
require.NoError(t, node.Stop())
|
2018-03-02 10:25:30 +01:00
|
|
|
}()
|
|
|
|
|
2021-07-09 15:19:33 +02:00
|
|
|
waku := node.WakuService()
|
|
|
|
require.NotNil(t, waku)
|
2018-03-02 10:25:30 +01:00
|
|
|
|
2021-05-14 12:55:42 +02:00
|
|
|
bloomFilter := waku.BloomFilter()
|
2018-03-02 10:25:30 +01:00
|
|
|
expectedEmptyBloomFilter := make([]byte, 64)
|
|
|
|
require.NotNil(t, bloomFilter)
|
|
|
|
require.Equal(t, expectedEmptyBloomFilter, bloomFilter)
|
|
|
|
}
|
|
|
|
|
2021-05-14 12:55:42 +02:00
|
|
|
func TestWakuLightModeEnabledSetsNilBloomFilter(t *testing.T) {
|
2018-04-16 14:36:09 +02:00
|
|
|
config := params.NodeConfig{
|
2020-01-08 12:12:23 +01:00
|
|
|
EnableNTPSync: true,
|
2021-05-14 12:55:42 +02:00
|
|
|
WakuConfig: params.WakuConfig{
|
2018-04-16 14:36:09 +02:00
|
|
|
Enabled: true,
|
|
|
|
LightClient: false,
|
|
|
|
},
|
|
|
|
}
|
2021-12-21 15:44:37 +00:00
|
|
|
node := New(nil)
|
2019-08-20 18:38:40 +03:00
|
|
|
require.NoError(t, node.Start(&config, &accounts.Manager{}))
|
2018-03-02 10:25:30 +01:00
|
|
|
defer func() {
|
2018-04-16 14:36:09 +02:00
|
|
|
require.NoError(t, node.Stop())
|
2018-03-02 10:25:30 +01:00
|
|
|
}()
|
|
|
|
|
2021-07-09 15:19:33 +02:00
|
|
|
waku := node.WakuService()
|
|
|
|
require.NotNil(t, waku)
|
2021-05-14 12:55:42 +02:00
|
|
|
require.Nil(t, waku.BloomFilter())
|
2020-02-18 12:21:01 +01:00
|
|
|
}
|