aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv5/api_test.go
diff options
context:
space:
mode:
authorgluk256 <gluk256@users.noreply.github.com>2017-02-23 16:41:47 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2017-02-23 16:41:47 +0800
commit29fac7de448c85049a97cbec3dc0819122bd2cb0 (patch)
treeeaa56d55f2ff5c15fca84a6d408d6aaff7d78404 /whisper/whisperv5/api_test.go
parent555273495b413069e9422b04aa46251146c752b2 (diff)
downloaddexon-29fac7de448c85049a97cbec3dc0819122bd2cb0.tar
dexon-29fac7de448c85049a97cbec3dc0819122bd2cb0.tar.gz
dexon-29fac7de448c85049a97cbec3dc0819122bd2cb0.tar.bz2
dexon-29fac7de448c85049a97cbec3dc0819122bd2cb0.tar.lz
dexon-29fac7de448c85049a97cbec3dc0819122bd2cb0.tar.xz
dexon-29fac7de448c85049a97cbec3dc0819122bd2cb0.tar.zst
dexon-29fac7de448c85049a97cbec3dc0819122bd2cb0.zip
Whisper API fixed (#3687)
* whisper: wnode updated for tests with geth * whisper: updated processing of incoming messages * whisper: symmetric encryption updated * whisper: filter id type changed to enhance security * whisper: allow filter without topic for asymmetric encryption * whisper: POW updated * whisper: logging updated * whisper: spellchecker update * whisper: error handling changed * whisper: JSON field names fixed
Diffstat (limited to 'whisper/whisperv5/api_test.go')
-rw-r--r--whisper/whisperv5/api_test.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/whisper/whisperv5/api_test.go b/whisper/whisperv5/api_test.go
index f7deab39c..ea0a2c40b 100644
--- a/whisper/whisperv5/api_test.go
+++ b/whisper/whisperv5/api_test.go
@@ -42,7 +42,7 @@ func TestBasic(t *testing.T) {
t.Fatalf("wrong version: %d.", ver)
}
- mail := api.GetFilterChanges(1)
+ mail := api.GetFilterChanges("non-existent-id")
if len(mail) != 0 {
t.Fatalf("failed GetFilterChanges: premature result")
}
@@ -152,7 +152,7 @@ func TestUnmarshalFilterArgs(t *testing.T) {
"keyname":"testname",
"pow":2.34,
"topics":["0x00000000", "0x007f80ff", "0xff807f00", "0xf26e7779"],
- "acceptP2P":true
+ "p2p":true
}`)
var f WhisperFilterArgs
@@ -212,8 +212,8 @@ func TestUnmarshalPostArgs(t *testing.T) {
"payload":"0x7061796C6F61642073686F756C642062652070736575646F72616E646F6D",
"worktime":777,
"pow":3.1416,
- "filterID":64,
- "peerID":"0xf26e7779"
+ "filterid":"test-filter-id",
+ "peerid":"0xf26e7779"
}`)
var a PostArgs
@@ -249,15 +249,15 @@ func TestUnmarshalPostArgs(t *testing.T) {
if a.PoW != 3.1416 {
t.Fatalf("wrong pow: %f.", a.PoW)
}
- if a.FilterID != 64 {
- t.Fatalf("wrong FilterID: %d.", a.FilterID)
+ if a.FilterID != "test-filter-id" {
+ t.Fatalf("wrong FilterID: %s.", a.FilterID)
}
if !bytes.Equal(a.PeerID[:], a.Topic[:]) {
t.Fatalf("wrong PeerID: %x.", a.PeerID)
}
}
-func waitForMessage(api *PublicWhisperAPI, id uint32, target int) bool {
+func waitForMessage(api *PublicWhisperAPI, id string, target int) bool {
for i := 0; i < 64; i++ {
all := api.GetMessages(id)
if len(all) >= target {