aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-11-04 17:49:25 +0800
committerobscuren <geffobscura@gmail.com>2014-11-04 17:49:25 +0800
commit1025d097fd4e5171dadb2c1a8eeb43b7730b13b6 (patch)
tree58653e1e86834107e6c22163c6ca29721e6b583b
parentd56d0c64aa84ae4f85f2ceb110e5b676f7adea7f (diff)
downloadgo-tangerine-1025d097fd4e5171dadb2c1a8eeb43b7730b13b6.tar.gz
go-tangerine-1025d097fd4e5171dadb2c1a8eeb43b7730b13b6.tar.zst
go-tangerine-1025d097fd4e5171dadb2c1a8eeb43b7730b13b6.zip
removed old bloom
-rw-r--r--chain/bloom.go47
-rw-r--r--chain/bloom_test.go20
2 files changed, 0 insertions, 67 deletions
diff --git a/chain/bloom.go b/chain/bloom.go
deleted file mode 100644
index 9d2cf439d..000000000
--- a/chain/bloom.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package chain
-
-type BloomFilter struct {
- bin []byte
-}
-
-func NewBloomFilter(bin []byte) *BloomFilter {
- if bin == nil {
- bin = make([]byte, 256)
- }
-
- return &BloomFilter{
- bin: bin,
- }
-}
-
-func (self *BloomFilter) Set(addr []byte) {
- if len(addr) < 8 {
- chainlogger.Warnf("err: bloom set to small: %x\n", addr)
-
- return
- }
-
- for _, i := range addr[len(addr)-8:] {
- self.bin[i] = 1
- }
-}
-
-func (self *BloomFilter) Search(addr []byte) bool {
- if len(addr) < 8 {
- chainlogger.Warnf("err: bloom search to small: %x\n", addr)
-
- return false
- }
-
- for _, i := range addr[len(addr)-8:] {
- if self.bin[i] == 0 {
- return false
- }
- }
-
- return true
-}
-
-func (self *BloomFilter) Bin() []byte {
- return self.bin
-}
diff --git a/chain/bloom_test.go b/chain/bloom_test.go
deleted file mode 100644
index 13c0d94e4..000000000
--- a/chain/bloom_test.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package chain
-
-import "testing"
-
-func TestBloomFilter(t *testing.T) {
- bf := NewBloomFilter(nil)
-
- a := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}
- bf.Set(a)
-
- b := []byte{10, 11, 12, 13, 14, 15, 16, 17, 18, 19}
-
- if bf.Search(a) == false {
- t.Error("Expected 'a' to yield true using a bloom filter")
- }
-
- if bf.Search(b) {
- t.Error("Expected 'b' not to field trie using a bloom filter")
- }
-}