aboutsummaryrefslogtreecommitdiffstats
path: root/event
diff options
context:
space:
mode:
Diffstat (limited to 'event')
-rw-r--r--event/filter/eth_filter.go (renamed from event/filter/old_filter.go)22
1 files changed, 16 insertions, 6 deletions
diff --git a/event/filter/old_filter.go b/event/filter/eth_filter.go
index 1a9a88173..295fcfbbf 100644
--- a/event/filter/old_filter.go
+++ b/event/filter/eth_filter.go
@@ -1,6 +1,7 @@
-// XXX This is the old filter system specifically for messages. This is till in used and could use some refactoring
package filter
+// TODO make use of the generic filtering system
+
import (
"sync"
@@ -59,7 +60,7 @@ func (self *FilterManager) GetFilter(id int) *core.Filter {
func (self *FilterManager) filterLoop() {
// Subscribe to events
- events := self.eventMux.Subscribe(core.NewBlockEvent{}, state.Messages(nil))
+ events := self.eventMux.Subscribe(core.PendingBlockEvent{}, core.NewBlockEvent{}, state.Logs(nil))
out:
for {
@@ -77,13 +78,22 @@ out:
}
self.filterMu.RUnlock()
- case state.Messages:
+ case core.PendingBlockEvent:
+ self.filterMu.RLock()
+ for _, filter := range self.filters {
+ if filter.PendingCallback != nil {
+ filter.PendingCallback(event.Block)
+ }
+ }
+ self.filterMu.RUnlock()
+
+ case state.Logs:
self.filterMu.RLock()
for _, filter := range self.filters {
- if filter.MessageCallback != nil {
- msgs := filter.FilterMessages(event)
+ if filter.LogsCallback != nil {
+ msgs := filter.FilterLogs(event)
if len(msgs) > 0 {
- filter.MessageCallback(msgs)
+ filter.LogsCallback(msgs)
}
}
}