2018-03-02 09:25:30 +00:00
|
|
|
package node
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
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) {
|
2023-03-27 14:33:00 +00:00
|
|
|
statusNode, err := createAndStartStatusNode(¶ms.NodeConfig{
|
2021-05-14 10:55:42 +00:00
|
|
|
WakuConfig: params.WakuConfig{
|
2018-04-16 12:36:09 +00:00
|
|
|
Enabled: true,
|
|
|
|
LightClient: true,
|
|
|
|
},
|
2023-03-27 14:33:00 +00:00
|
|
|
})
|
|
|
|
require.NoError(t, err)
|
2018-03-02 09:25:30 +00:00
|
|
|
defer func() {
|
2023-03-27 14:33:00 +00:00
|
|
|
err := statusNode.Stop()
|
|
|
|
require.NoError(t, err)
|
2018-03-02 09:25:30 +00:00
|
|
|
}()
|
|
|
|
|
2023-03-27 14:33:00 +00:00
|
|
|
waku := statusNode.WakuService()
|
2021-07-09 13:19:33 +00:00
|
|
|
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) {
|
2023-03-27 14:33:00 +00:00
|
|
|
statusNode, err := createAndStartStatusNode(¶ms.NodeConfig{
|
2021-05-14 10:55:42 +00:00
|
|
|
WakuConfig: params.WakuConfig{
|
2018-04-16 12:36:09 +00:00
|
|
|
Enabled: true,
|
|
|
|
LightClient: false,
|
|
|
|
},
|
2023-03-27 14:33:00 +00:00
|
|
|
})
|
|
|
|
require.NoError(t, err)
|
2018-03-02 09:25:30 +00:00
|
|
|
defer func() {
|
2023-03-27 14:33:00 +00:00
|
|
|
err := statusNode.Stop()
|
|
|
|
require.NoError(t, err)
|
2018-03-02 09:25:30 +00:00
|
|
|
}()
|
|
|
|
|
2023-03-27 14:33:00 +00:00
|
|
|
waku := statusNode.WakuService()
|
2021-07-09 13:19:33 +00:00
|
|
|
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
|
|
|
}
|