aboutsummaryrefslogtreecommitdiffstats
path: root/core/filter.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-17 18:19:23 +0800
committerobscuren <geffobscura@gmail.com>2015-03-17 18:19:23 +0800
commit515d9432fcef8c574627049d437d6898b56c2829 (patch)
tree40322c532a38b8f563d452bd75dab69729e55d92 /core/filter.go
parent8ce6a3647821706cf5e9bb1a9dc13f23c84f6585 (diff)
downloadgo-tangerine-515d9432fcef8c574627049d437d6898b56c2829.tar
go-tangerine-515d9432fcef8c574627049d437d6898b56c2829.tar.gz
go-tangerine-515d9432fcef8c574627049d437d6898b56c2829.tar.bz2
go-tangerine-515d9432fcef8c574627049d437d6898b56c2829.tar.lz
go-tangerine-515d9432fcef8c574627049d437d6898b56c2829.tar.xz
go-tangerine-515d9432fcef8c574627049d437d6898b56c2829.tar.zst
go-tangerine-515d9432fcef8c574627049d437d6898b56c2829.zip
converted vm
Diffstat (limited to 'core/filter.go')
-rw-r--r--core/filter.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/core/filter.go b/core/filter.go
index d58aa8d7c..e08aac120 100644
--- a/core/filter.go
+++ b/core/filter.go
@@ -1,9 +1,9 @@
package core
import (
- "bytes"
"math"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/state"
)
@@ -16,8 +16,8 @@ type FilterOptions struct {
Earliest int64
Latest int64
- Address [][]byte
- Topics [][][]byte
+ Address []common.Address
+ Topics [][]common.Hash
Skip int
Max int
@@ -29,9 +29,9 @@ type Filter struct {
earliest int64
latest int64
skip int
- address [][]byte
+ address []common.Address
max int
- topics [][][]byte
+ topics [][]common.Hash
BlockCallback func(*types.Block)
PendingCallback func(*types.Block)
@@ -67,11 +67,11 @@ func (self *Filter) SetLatestBlock(latest int64) {
self.latest = latest
}
-func (self *Filter) SetAddress(addr [][]byte) {
+func (self *Filter) SetAddress(addr []common.Address) {
self.address = addr
}
-func (self *Filter) SetTopics(topics [][][]byte) {
+func (self *Filter) SetTopics(topics [][]common.Hash) {
self.topics = topics
}
@@ -131,9 +131,9 @@ func (self *Filter) Find() state.Logs {
return logs[skip:]
}
-func includes(addresses [][]byte, a []byte) bool {
+func includes(addresses []common.Address, a common.Address) bool {
for _, addr := range addresses {
- if !bytes.Equal(addr, a) {
+ if addr != a {
return false
}
}
@@ -151,13 +151,13 @@ Logs:
continue
}
- logTopics := make([][]byte, len(self.topics))
+ logTopics := make([]common.Hash, len(self.topics))
copy(logTopics, log.Topics())
for i, topics := range self.topics {
for _, topic := range topics {
var match bool
- if bytes.Equal(log.Topics()[i], topic) {
+ if log.Topics()[i] == topic {
match = true
}
if !match {
@@ -176,7 +176,7 @@ func (self *Filter) bloomFilter(block *types.Block) bool {
if len(self.address) > 0 {
var included bool
for _, addr := range self.address {
- if types.BloomLookup(block.Bloom(), addr) {
+ if types.BloomLookup(block.Bloom(), addr.Hash()) {
included = true
break
}