status-go/node/geth_node_api_test.go

54 lines
1.1 KiB
Go
Raw Normal View History

package node
import (
"testing"
"github.com/ethereum/go-ethereum/accounts"
2020-01-02 09:10:19 +00:00
"github.com/stretchr/testify/require"
"github.com/status-im/status-go/params"
)
2021-05-14 10:55:42 +00:00
func TestWakuLightModeEnabledSetsEmptyBloomFilter(t *testing.T) {
config := params.NodeConfig{
2020-01-08 11:12:23 +00:00
EnableNTPSync: true,
2021-05-14 10:55:42 +00:00
WakuConfig: params.WakuConfig{
Enabled: true,
LightClient: true,
},
}
2021-12-21 15:44:37 +00:00
node := New(nil)
require.NoError(t, node.Start(&config, &accounts.Manager{}))
defer func() {
require.NoError(t, node.Stop())
}()
waku := node.WakuService()
require.NotNil(t, waku)
2021-05-14 10:55:42 +00:00
bloomFilter := waku.BloomFilter()
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) {
config := params.NodeConfig{
2020-01-08 11:12:23 +00:00
EnableNTPSync: true,
2021-05-14 10:55:42 +00:00
WakuConfig: params.WakuConfig{
Enabled: true,
LightClient: false,
},
}
2021-12-21 15:44:37 +00:00
node := New(nil)
require.NoError(t, node.Start(&config, &accounts.Manager{}))
defer func() {
require.NoError(t, node.Stop())
}()
waku := node.WakuService()
require.NotNil(t, waku)
2021-05-14 10:55:42 +00:00
require.Nil(t, waku.BloomFilter())
}