forked from cerc-io/plugeth
whisper: cleanup lefover scoping
This commit is contained in:
parent
bd14bd6c5b
commit
4afc22ba6e
@ -52,7 +52,7 @@ func (self *Topic) String() string {
|
|||||||
type topicSet map[string]struct{}
|
type topicSet map[string]struct{}
|
||||||
|
|
||||||
// NewTopicSet creates a topic hash set from a slice of topics.
|
// NewTopicSet creates a topic hash set from a slice of topics.
|
||||||
func NewTopicSet(topics []Topic) topicSet {
|
func newTopicSet(topics []Topic) topicSet {
|
||||||
set := make(map[string]struct{})
|
set := make(map[string]struct{})
|
||||||
for _, topic := range topics {
|
for _, topic := range topics {
|
||||||
set[topic.String()] = struct{}{}
|
set[topic.String()] = struct{}{}
|
||||||
|
@ -57,7 +57,7 @@ func TestTopicSetCreation(t *testing.T) {
|
|||||||
for i, tt := range topicCreationTests {
|
for i, tt := range topicCreationTests {
|
||||||
topics[i] = NewTopic(tt.data)
|
topics[i] = NewTopic(tt.data)
|
||||||
}
|
}
|
||||||
set := NewTopicSet(topics)
|
set := newTopicSet(topics)
|
||||||
for i, tt := range topicCreationTests {
|
for i, tt := range topicCreationTests {
|
||||||
topic := NewTopic(tt.data)
|
topic := NewTopic(tt.data)
|
||||||
if _, ok := set[topic.String()]; !ok {
|
if _, ok := set[topic.String()]; !ok {
|
||||||
|
@ -119,7 +119,7 @@ func (self *Whisper) Watch(options Filter) int {
|
|||||||
filter := filter.Generic{
|
filter := filter.Generic{
|
||||||
Str1: string(crypto.FromECDSAPub(options.To)),
|
Str1: string(crypto.FromECDSAPub(options.To)),
|
||||||
Str2: string(crypto.FromECDSAPub(options.From)),
|
Str2: string(crypto.FromECDSAPub(options.From)),
|
||||||
Data: NewTopicSet(options.Topics),
|
Data: newTopicSet(options.Topics),
|
||||||
Fn: func(data interface{}) {
|
Fn: func(data interface{}) {
|
||||||
options.Fn(data.(*Message))
|
options.Fn(data.(*Message))
|
||||||
},
|
},
|
||||||
@ -281,7 +281,7 @@ func createFilter(message *Message, topics []Topic) filter.Filter {
|
|||||||
return filter.Generic{
|
return filter.Generic{
|
||||||
Str1: string(crypto.FromECDSAPub(message.To)),
|
Str1: string(crypto.FromECDSAPub(message.To)),
|
||||||
Str2: string(crypto.FromECDSAPub(message.Recover())),
|
Str2: string(crypto.FromECDSAPub(message.Recover())),
|
||||||
Data: NewTopicSet(topics),
|
Data: newTopicSet(topics),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user