Whisper watches fixes

This commit is contained in:
obscuren
2014-12-16 19:55:57 +01:00
parent 93edae280d
commit 52b54631a4
6 changed files with 56 additions and 16 deletions

View File

@@ -18,10 +18,19 @@ func Topics(data [][]byte) [][]byte {
return d
}
func TopicsFromString(data []string) [][]byte {
func TopicsFromString(data ...string) [][]byte {
d := make([][]byte, len(data))
for i, str := range data {
d[i] = hashTopic([]byte(str))
}
return d
}
func bytesToMap(s [][]byte) map[string]struct{} {
m := make(map[string]struct{})
for _, topic := range s {
m[string(topic)] = struct{}{}
}
return m
}