aboutsummaryrefslogtreecommitdiffstats
path: root/core/types
diff options
context:
space:
mode:
Diffstat (limited to 'core/types')
-rw-r--r--core/types/bloom9.go28
1 files changed, 10 insertions, 18 deletions
diff --git a/core/types/bloom9.go b/core/types/bloom9.go
index bdc6e60e7..a76b6f33c 100644
--- a/core/types/bloom9.go
+++ b/core/types/bloom9.go
@@ -28,10 +28,16 @@ type bytesBacked interface {
Bytes() []byte
}
-const bloomLength = 256
+const (
+ // BloomByteLength represents the number of bytes used in a header log bloom.
+ BloomByteLength = 256
-// Bloom represents a 256 bit bloom filter.
-type Bloom [bloomLength]byte
+ // BloomBitLength represents the number of bits used in a header log bloom.
+ BloomBitLength = 8 * BloomByteLength
+)
+
+// Bloom represents a 2048 bit bloom filter.
+type Bloom [BloomByteLength]byte
// BytesToBloom converts a byte slice to a bloom filter.
// It panics if b is not of suitable size.
@@ -47,7 +53,7 @@ func (b *Bloom) SetBytes(d []byte) {
if len(b) < len(d) {
panic(fmt.Sprintf("bloom bytes too big %d %d", len(b), len(d)))
}
- copy(b[bloomLength-len(d):], d)
+ copy(b[BloomByteLength-len(d):], d)
}
// Add adds d to the filter. Future calls of Test(d) will return true.
@@ -106,20 +112,6 @@ func LogsBloom(logs []*Log) *big.Int {
return bin
}
-type BloomIndexList [3]uint
-
-// BloomIndexes returns the bloom filter bit indexes belonging to the given key
-func BloomIndexes(b []byte) BloomIndexList {
- b = crypto.Keccak256(b[:])
-
- var r [3]uint
- for i, _ := range r {
- r[i] = (uint(b[i+i+1]) + (uint(b[i+i]) << 8)) & 2047
- }
-
- return r
-}
-
func bloom9(b []byte) *big.Int {
b = crypto.Keccak256(b[:])