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

@@ -272,16 +272,16 @@ func (w *Whisper) GetSymKey(name string) []byte {
// Watch installs a new message handler to run in case a matching packet arrives
// from the whisper network.
func (w *Whisper) Watch(f *Filter) uint32 {
func (w *Whisper) Watch(f *Filter) (string, error) {
return w.filters.Install(f)
}
func (w *Whisper) GetFilter(id uint32) *Filter {
func (w *Whisper) GetFilter(id string) *Filter {
return w.filters.Get(id)
}
// Unwatch removes an installed message handler.
func (w *Whisper) Unwatch(id uint32) {
func (w *Whisper) Unwatch(id string) {
w.filters.Uninstall(id)
}
@@ -575,7 +575,7 @@ func (w *Whisper) Envelopes() []*Envelope {
}
// Messages retrieves all the decrypted messages matching a filter id.
func (w *Whisper) Messages(id uint32) []*ReceivedMessage {
func (w *Whisper) Messages(id string) []*ReceivedMessage {
result := make([]*ReceivedMessage, 0)
w.poolMu.RLock()
defer w.poolMu.RUnlock()