aboutsummaryrefslogtreecommitdiffstats
path: root/event
diff options
context:
space:
mode:
authorAlexandre Van de Sande <alex.vandesande@ethdev.com>2015-02-23 20:05:15 +0800
committerAlexandre Van de Sande <alex.vandesande@ethdev.com>2015-02-23 20:05:15 +0800
commitdea65840186fe861017524c9cb59ae07ac97ed06 (patch)
tree5cb5e339b9ce77a2a3c92cf8a10c4294fcf7965c /event
parentbb3338df6363d8267a24190584f0908463241a6c (diff)
parentdd086791acf477da7641c168f82de70ed0b2dca6 (diff)
downloadgo-tangerine-dea65840186fe861017524c9cb59ae07ac97ed06.tar.gz
go-tangerine-dea65840186fe861017524c9cb59ae07ac97ed06.tar.zst
go-tangerine-dea65840186fe861017524c9cb59ae07ac97ed06.zip
Merge branch 'develop' into ui
Diffstat (limited to 'event')
-rw-r--r--event/filter/eth_filter.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/event/filter/eth_filter.go b/event/filter/eth_filter.go
index 295fcfbbf..73d2cd935 100644
--- a/event/filter/eth_filter.go
+++ b/event/filter/eth_filter.go
@@ -3,6 +3,7 @@ package filter
// TODO make use of the generic filtering system
import (
+ "fmt"
"sync"
"github.com/ethereum/go-ethereum/core"
@@ -37,17 +38,18 @@ func (self *FilterManager) Stop() {
func (self *FilterManager) InstallFilter(filter *core.Filter) (id int) {
self.filterMu.Lock()
+ defer self.filterMu.Unlock()
id = self.filterId
self.filters[id] = filter
self.filterId++
- self.filterMu.Unlock()
+
return id
}
func (self *FilterManager) UninstallFilter(id int) {
self.filterMu.Lock()
+ defer self.filterMu.Unlock()
delete(self.filters, id)
- self.filterMu.Unlock()
}
// GetFilter retrieves a filter installed using InstallFilter.
@@ -60,7 +62,10 @@ func (self *FilterManager) GetFilter(id int) *core.Filter {
func (self *FilterManager) filterLoop() {
// Subscribe to events
- events := self.eventMux.Subscribe(core.PendingBlockEvent{}, core.NewBlockEvent{}, state.Logs(nil))
+ events := self.eventMux.Subscribe(
+ core.PendingBlockEvent{},
+ //core.ChainEvent{},
+ state.Logs(nil))
out:
for {
@@ -69,7 +74,8 @@ out:
break out
case event := <-events.Chan():
switch event := event.(type) {
- case core.NewBlockEvent:
+ case core.ChainEvent:
+ fmt.Println("filter start")
self.filterMu.RLock()
for _, filter := range self.filters {
if filter.BlockCallback != nil {
@@ -77,6 +83,7 @@ out:
}
}
self.filterMu.RUnlock()
+ fmt.Println("filter stop")
case core.PendingBlockEvent:
self.filterMu.RLock()