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