diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/filter.go | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/core/filter.go b/core/filter.go index a458165f5..c22996d7e 100644 --- a/core/filter.go +++ b/core/filter.go @@ -2,7 +2,6 @@ package core import ( "bytes" - "fmt" "math" "github.com/ethereum/go-ethereum/core/types" @@ -129,37 +128,33 @@ func (self *Filter) Find() state.Logs { return logs[skip:] } -func includes(addresses [][]byte, a []byte) (found bool) { +func includes(addresses [][]byte, a []byte) bool { for _, addr := range addresses { - fmt.Println("INCLUDES", addr, a) - if bytes.Compare(addr, a) == 0 { - return true + if !bytes.Equal(addr, a) { + return false } } - return + return true } func (self *Filter) FilterLogs(logs state.Logs) state.Logs { - fmt.Println("FILTER LOGS", self.topics) var ret state.Logs // Filter the logs for interesting stuff +Logs: for _, log := range logs { - fmt.Println(log) - if len(self.address) > 0 && !bytes.Equal(self.address, log.Address()) { continue } - for _, topic := range self.topics { - fmt.Println("TOPIC:", topic) - if !includes(log.Topics(), topic) { - continue + max := int(math.Min(float64(len(self.topics)), float64(len(log.Topics())))) + for i := 0; i < max; i++ { + if !bytes.Equal(log.Topics()[i], self.topics[i]) { + continue Logs } } - fmt.Println("APPENDED") ret = append(ret, log) } |