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
This commit is contained in:
gluk256
2017-02-23 09:41:47 +01:00
committed by Jeffrey Wilcke
parent 555273495b
commit 29fac7de44
11 changed files with 182 additions and 111 deletions

View File

@@ -79,7 +79,7 @@ type TestNode struct {
shh *Whisper
id *ecdsa.PrivateKey
server *p2p.Server
filerId uint32
filerId string
}
var result TestData
@@ -122,7 +122,10 @@ func initialize(t *testing.T) {
topics := make([]TopicType, 0)
topics = append(topics, sharedTopic)
f := Filter{KeySym: sharedKey, Topics: topics}
node.filerId = node.shh.Watch(&f)
node.filerId, err = node.shh.Watch(&f)
if err != nil {
t.Fatalf("failed to install the filter: %s.", err)
}
node.id, err = crypto.HexToECDSA(keys[i])
if err != nil {
t.Fatalf("failed convert the key: %s.", keys[i])
@@ -187,7 +190,7 @@ func checkPropagation(t *testing.T) {
for i := 0; i < NumNodes; i++ {
f := nodes[i].shh.GetFilter(nodes[i].filerId)
if f == nil {
t.Fatalf("failed to get filterId %d from node %d.", nodes[i].filerId, i)
t.Fatalf("failed to get filterId %s from node %d.", nodes[i].filerId, i)
}
mail := f.Retrieve()