mirror of
https://github.com/status-im/status-go.git
synced 2025-01-10 14:47:06 +00:00
6cdea4ef97
* Update project to use Whisper v6. Part of #638 * Revert "Add patch to downgrade usage of Whisper v6 to v5 in some geth 1.8.1 vendor files. Part of #665" - this reverts commit 6aefb4c8fd02dbcfffac6b69e8bb22b13ef86b6b. * Enable light mode on Whisper v6 for non-mail servers. Part of #638 * Fix race condition in whisperv6/peer.go. Part of #665 (PR already accepted upstream for 1.8.2) * Update bootnode addresses in staticnodes.json. Part of #638 * Add `shh.lightclient` flag and tests for bloom filter setting logic. Part of #638 * Move MakeTestNodeConfig to utils. Part of #638 * Reduce PoW in `whisper_jail_test.go` to fix flaky test. Part of #638
53 lines
1.2 KiB
Go
53 lines
1.2 KiB
Go
package node
|
|
|
|
import (
|
|
"testing"
|
|
|
|
whisper "github.com/ethereum/go-ethereum/whisper/whisperv6"
|
|
|
|
. "github.com/status-im/status-go/t/utils"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestWhisperLightModeEnabledSetsEmptyBloomFilter(t *testing.T) {
|
|
config, err := MakeTestNodeConfig(GetNetworkID())
|
|
require.NoError(t, err)
|
|
config.WhisperConfig.LightClient = true
|
|
|
|
node, nodeErr := MakeNode(config)
|
|
require.NoError(t, nodeErr)
|
|
require.NoError(t, node.Start())
|
|
defer func() {
|
|
err := node.Stop()
|
|
require.NoError(t, err)
|
|
}()
|
|
|
|
var whisper *whisper.Whisper
|
|
err = node.Service(&whisper)
|
|
require.NoError(t, err)
|
|
|
|
bloomFilter := whisper.BloomFilter()
|
|
expectedEmptyBloomFilter := make([]byte, 64)
|
|
require.NotNil(t, bloomFilter)
|
|
require.Equal(t, expectedEmptyBloomFilter, bloomFilter)
|
|
}
|
|
|
|
func TestWhisperLightModeEnabledSetsNilBloomFilter(t *testing.T) {
|
|
config, err := MakeTestNodeConfig(GetNetworkID())
|
|
require.NoError(t, err)
|
|
config.WhisperConfig.LightClient = false
|
|
|
|
node, nodeErr := MakeNode(config)
|
|
require.NoError(t, nodeErr)
|
|
require.NoError(t, node.Start())
|
|
defer func() {
|
|
err := node.Stop()
|
|
require.NoError(t, err)
|
|
}()
|
|
|
|
var whisper *whisper.Whisper
|
|
err = node.Service(&whisper)
|
|
require.NoError(t, err)
|
|
require.Nil(t, whisper.BloomFilter())
|
|
}
|