aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv6/filter_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'whisper/whisperv6/filter_test.go')
-rw-r--r--whisper/whisperv6/filter_test.go36
1 files changed, 30 insertions, 6 deletions
diff --git a/whisper/whisperv6/filter_test.go b/whisper/whisperv6/filter_test.go
index 58d90d60c..dd0de0f6e 100644
--- a/whisper/whisperv6/filter_test.go
+++ b/whisper/whisperv6/filter_test.go
@@ -229,6 +229,36 @@ func TestInstallIdenticalFilters(t *testing.T) {
}
}
+func TestInstallFilterWithSymAndAsymKeys(t *testing.T) {
+ InitSingleTest()
+
+ w := New(&Config{})
+ filters := NewFilters(w)
+ filter1, _ := generateFilter(t, true)
+
+ asymKey, err := crypto.GenerateKey()
+ if err != nil {
+ t.Fatalf("Unable to create asymetric keys: %v", err)
+ }
+
+ // Copy the first filter since some of its fields
+ // are randomly gnerated.
+ filter := &Filter{
+ KeySym: filter1.KeySym,
+ KeyAsym: asymKey,
+ Topics: filter1.Topics,
+ PoW: filter1.PoW,
+ AllowP2P: filter1.AllowP2P,
+ Messages: make(map[common.Hash]*ReceivedMessage),
+ }
+
+ _, err = filters.Install(filter)
+
+ if err == nil {
+ t.Fatalf("Error detecting that a filter had both an asymmetric and symmetric key, with seed %d", seed)
+ }
+}
+
func TestComparePubKey(t *testing.T) {
InitSingleTest()
@@ -312,12 +342,6 @@ func TestMatchEnvelope(t *testing.T) {
t.Fatalf("failed MatchEnvelope() symmetric with seed %d.", seed)
}
- // asymmetric + matching topic: mismatch
- match = fasym.MatchEnvelope(env)
- if match {
- t.Fatalf("failed MatchEnvelope() asymmetric with seed %d.", seed)
- }
-
// symmetric + matching topic + insufficient PoW: mismatch
fsym.PoW = env.PoW() + 1.0
match = fsym.MatchEnvelope(env)