提交 2ef044ed 编写于 作者: O obscuren

Use new bloom when filtering for topics

上级 cc67a84e
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
func TestBloom9(t *testing.T) { func TestBloom9(t *testing.T) {
testCase := []byte("testtest") testCase := []byte("testtest")
bin := LogsBloom([]vm.Log{vm.Log{testCase, nil, nil}}).Bytes() bin := LogsBloom([]vm.Log{vm.Log{testCase, [][]byte{[]byte("hellohello")}, nil}}).Bytes()
res := BloomLookup(bin, testCase) res := BloomLookup(bin, testCase)
if !res { if !res {
......
...@@ -170,13 +170,10 @@ func (self *Filter) FilterMessages(msgs []*ethstate.Message) []*ethstate.Message ...@@ -170,13 +170,10 @@ func (self *Filter) FilterMessages(msgs []*ethstate.Message) []*ethstate.Message
} }
func (self *Filter) bloomFilter(block *Block) bool { func (self *Filter) bloomFilter(block *Block) bool {
// TODO update to the new bloom filter
bloom := NewBloomFilter(nil)
var fromIncluded, toIncluded bool var fromIncluded, toIncluded bool
if len(self.from) > 0 { if len(self.from) > 0 {
for _, from := range self.from { for _, from := range self.from {
if bloom.Search(from) { if BloomLookup(block.LogsBloom, from) {
fromIncluded = true fromIncluded = true
break break
} }
...@@ -187,7 +184,7 @@ func (self *Filter) bloomFilter(block *Block) bool { ...@@ -187,7 +184,7 @@ func (self *Filter) bloomFilter(block *Block) bool {
if len(self.to) > 0 { if len(self.to) > 0 {
for _, to := range self.to { for _, to := range self.to {
if bloom.Search(to) { if BloomLookup(block.LogsBloom, to) {
toIncluded = true toIncluded = true
break break
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册