aboutsummaryrefslogtreecommitdiffstats
path: root/core/types/bloom9_test.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-10-12 23:58:51 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-10-17 03:28:59 +0800
commit6dc14788a238f3e0ec786c6c04d476a3b957e645 (patch)
tree8f3f5f91506bc4c7532543043add1eaea3fd28e7 /core/types/bloom9_test.go
parent30f057aaf9891fb37f82d94c24b8aa35d388e07b (diff)
downloaddexon-6dc14788a238f3e0ec786c6c04d476a3b957e645.tar
dexon-6dc14788a238f3e0ec786c6c04d476a3b957e645.tar.gz
dexon-6dc14788a238f3e0ec786c6c04d476a3b957e645.tar.bz2
dexon-6dc14788a238f3e0ec786c6c04d476a3b957e645.tar.lz
dexon-6dc14788a238f3e0ec786c6c04d476a3b957e645.tar.xz
dexon-6dc14788a238f3e0ec786c6c04d476a3b957e645.tar.zst
dexon-6dc14788a238f3e0ec786c6c04d476a3b957e645.zip
core, eth/filters, miner, xeth: Optimised log filtering
Log filtering is now using a MIPmap like approach where addresses of logs are added to a mapped bloom bin. The current levels for the MIP are in ranges of 1.000.000, 500.000, 100.000, 50.000, 1.000. Logs are therefor filtered in batches of 1.000.
Diffstat (limited to 'core/types/bloom9_test.go')
-rw-r--r--core/types/bloom9_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/core/types/bloom9_test.go b/core/types/bloom9_test.go
index f020670b1..5744bec6c 100644
--- a/core/types/bloom9_test.go
+++ b/core/types/bloom9_test.go
@@ -16,6 +16,40 @@
package types
+import (
+ "math/big"
+ "testing"
+)
+
+func TestBloom(t *testing.T) {
+ positive := []string{
+ "testtest",
+ "test",
+ "hallo",
+ "other",
+ }
+ negative := []string{
+ "tes",
+ "lo",
+ }
+
+ var bloom Bloom
+ for _, data := range positive {
+ bloom.Add(new(big.Int).SetBytes([]byte(data)))
+ }
+
+ for _, data := range positive {
+ if !bloom.Test(new(big.Int).SetBytes([]byte(data))) {
+ t.Error("expected", data, "to test true")
+ }
+ }
+ for _, data := range negative {
+ if bloom.Test(new(big.Int).SetBytes([]byte(data))) {
+ t.Error("did not expect", data, "to test true")
+ }
+ }
+}
+
/*
import (
"testing"